User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 401,551 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,557 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting

I have a link wich opens a the second page with links wich call a javascript functio

Join Date: Jun 2006
Location: India
Posts: 6,811
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 339
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Rebellion Revamped

Re: I have a link wich opens a the second page with links wich call a javascript functio

  #2  
Jul 14th, 2007
You can access the parent window or the window which opened the new window using the global reference 'opener'.

Keep one hidden field each for the data which you want to pass from the new page to the original page and using the reference of the original page (opener), manipulate the fields of the parent window.

Something like this:
  1. <!-- Parent (ee.html) -->
  2. <html>
  3. <head>
  4. <script>
  5. function go()
  6. {
  7. window.open("dd.html");
  8. }
  9. </script>
  10. </head>
  11. <body>
  12. <form name="frm">
  13. <input type="text" value="Hello" id="txt" name="txt" />
  14. <input type="button" name="btn" id="btn" value="Button" onclick="go();" />
  15. </form>
  16. </body>
  17. </html>

  1. <!-- Child (dd.html) -->
  2. <html>
  3. <head>
  4. <script>
  5. function go()
  6. {
  7. alert(opener.document.frm.txt.value);
  8. }
  9. function change()
  10. {
  11. opener.document.frm.txt.value = "This is changed text";
  12. this.close();
  13. opener.focus();
  14. }
  15. </script>
  16. </head>
  17. <body onload="go();">
  18. <form>
  19. <input type="button" value="Change Value in Parent" id="btn" name="btn" onclick="change();"/>
  20. </form>
  21. </body>
  22. </html>
Last edited by ~s.o.s~ : Jul 14th, 2007 at 3:26 pm.
"I don't accept change. I don't deserve to live."

"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
Reply With Quote  
All times are GMT -4. The time now is 3:32 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC