kvarnerexpress 0 Report post Posted April 29, 2005 (edited) worked on a simple window.opner() and it worked fine like this. function popupwindow() { var window_open = window.open('childwindow.html','venderfindwindow','width=1000,height=700'); } </script> <form name="productCode"> <input type="text" name="Vender1" id="Vender1" width="45"> <input type="button" value="Find" onClick=popupwindow(); return false;") </form> <form name="vederlookup"> <input type="text" value="" name="Vender1" size="5"></td></tr> <a href="javascript: doStuff('this');">close</a> </form> function doStuff(findItem){ window.opener.document.getElementById('Vender1').value=findItem; window.close(); } The above worked as expected. However, when I change the second file like this it does not close the window or communicate to the parent window. I wonder what am I doing wrong?<form name="venderlookup"> <input name="searchtext" value=""><input type="submit" value="Search" onClick='goSearch()';> </form> <script language="JavaScript"> function goSearch() { document.write("hello world!"); document.write('<form name="form1">'); document.write('<a href="javascript: doStuff("this");">close</a>'); document.write('</form>'); } The last example does not close the window. Could you do like this" document.write('<a href="javascript: doStuff("this");">close</a>');"Also, when I call my function goSearch() it takes removes the form from the screen and just shows the output of the function. Is it possible to continue to view the form without using frames? Notice from snlildude87: Use code BBCode tags Edited April 29, 2005 by snlildude87 (see edit history) Share this post Link to post Share on other sites
electriic ink 1 Report post Posted April 30, 2005 Because, of your use of " and ' <a href="javascript: doStuff("this");"> It should be: <a href="javascript: doStuff('this');"> Your using the speech marks in the command 2 times so html will close the command when it sees the speech marks again. So it sees what your trying to do as this: <a href="javascript: doStuff("this");"> The part in red is how it sees your link. The other part in blue it sees as stuff it doesn't need so it springs up a code error and doesn't work. Understand? Right, now you want to write it in javascript and you want to use 3 types of speech marks for that but you only have 2 (' and "). So you need to write it like this: document.write("<a href=\"javascript: doStuff('this');\">"); I've added red marks where the key is the backslash. This is javascript 3rd speech mark only to be used inside document.write() and is the the answer to your worries! Share this post Link to post Share on other sites