HI Jesh,I was successful to some extent ,but not completely. In the below code in function "whichelement" i have alert statement todetermine what are the values that are passed to the parent window. When I put the alert(tvalue) in function i got undefined as the output.I think using the targ.value will not fetch the value of the cell on which i have clicked. How do i get the value in the cel on which i have clicked.
<html><head><script type="text/javascript">var tvalue ;var tname;function whichelement(e){var targ;if(!e) var e = window.event;if (e.target ) targ = e.target;else if (e. srcElement ) targ = e.srcElement;tname=targ.tagNameif(tname== "td" || tname == "TD") { // OK, the element that sent the event was a td element. // now we can update the content of the text input.tvalue = targ.value;alert(tvalue); document.getElementById("field").value = tvalue; }}function createNewDoc() { var newwindow=window.open(); var txt="<html><body onmousedown = window.opener.whichelement(event)><table border = 1 id = cells><tr><td>ABC</td><td>good</td></tr>";txt +="<tr><td>123</td><td>verygood</td></tr></table></body></html>"; newwindow.document.write(txt);<!-- var x = newwindow.document.getElementById("cells").rows[0].cells; --><!-- var firstcell = x[0].innerHTML; -->//document.getElementById("field").value = tvalue; }</script></head><body><input type = "text" id = "field"><input type="button" value="Open and write to a new document" onclick="createNewDoc()"></body></html>