MrAdam Posted February 17, 2008 Share Posted February 17, 2008 Basically what I'm trying to do is create a window using the window.open method (name set as 'idFinder') which is my little tool for finding an ID as the name kinda suggests. Once they find their ID i have a button which is to 'add' the id (which is stored in a text field) to the main window and close the idFinder window...I've been scouting around for a fairly long time and I've got no where, could anyone giy us any help?Cheers, Adam Link to comment Share on other sites More sharing options...
jhecht Posted February 17, 2008 Share Posted February 17, 2008 This is in the base window var idFinder = window.open('yourPage.php','idField','params here');...<input type="text" name="userId" id="userId" /> This is in yourPage.php function addMe(value){ window.opener.document.getElementById('userId').value=value;}...Jhecht <button onclick="addMe('Jhecht')">Add This User</button> Link to comment Share on other sites More sharing options...
jeffman Posted February 18, 2008 Share Posted February 18, 2008 I have no interest in competing with Jhecht, but since I wrote the code, I figured I'd post it. They're about the same.Page 1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <meta name="generator" content="Adobe GoLive"> <title>Untitled Page</title> </head> <body bgcolor="#ffffff"> <input type="text" id='targetText' size="24" /> <button name="buttonName" type="button" onclick="openWin()">openwindow</button> <script> function openWin(){ window.open("http://www.sophox.com/source.html","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400"); } </script> </body> </html> Page 2: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body bgcolor="#ffffff"> <input type="text" id='sourceText' size="24" /> <button onclick="sendID()">Send ID</button> <script> function sendID(){ s = document.getElementById('sourceText'); t = window.opener.document.getElementById('targetText'); t.value = s.value; } </script> </body> </html> Link to comment Share on other sites More sharing options...
jhecht Posted February 18, 2008 Share Posted February 18, 2008 I'd go with Deirdre's Dad's code. His looks nicer lol. Link to comment Share on other sites More sharing options...
MrAdam Posted February 18, 2008 Author Share Posted February 18, 2008 cheers lads! was that "opener" i was missing...Adam Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.