Parent/Child Windows

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Jun 2006
Posts: 7,616
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 466
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Parent/Child Windows

 
0
  #11
Aug 2nd, 2007
> This still isn't working. Can someone help?
I am sorry to say this, but you have lost the ability to see things as they are. My first post pointed out the mistakes in your code, my second post was a piece of working code and you still come back and say it isn't working?

If you plan on ignoring our posts and advice, do let us know in advance.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 13
Reputation: JC4QLx3 is an unknown quantity at this point 
Solved Threads: 0
JC4QLx3 JC4QLx3 is offline Offline
Newbie Poster

Re: Parent/Child Windows

 
0
  #12
Aug 2nd, 2007
I am sorry. Maybe you missed what I said.

Your code did work fine, but only for one window, not 3. We have 3 windows that the user may choose to have open at the same time. That is why I needed to make a change. I did say that I am a novice and what seems obvious to you is extremely difficult for me. Not only did I NOT ignore you, I also took the advice from the other person and changed 'name' to theName. I must have something wrong, but for the life of me, I can't find it.

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <SCRIPT>
  2. <!--
  3. // create a custom window
  4. function openWindow(url, wnd)
  5. {
  6. var theName = null;
  7. theName = wnd;
  8.  
  9. if (!theName || theName.closed)
  10. {
  11. var windowHeight,windowWidth,windowTop,windowLeft
  12. windowHeight = screen.availHeight;
  13. windowWidth = screen.availWidth;
  14. windowTop = 0;
  15. windowLeft = 0;
  16.  
  17. var varStore = "";
  18. varStore = varStore + "width=" + windowWidth;
  19. varStore = varStore + ",height=" + windowHeight;
  20. varStore = varStore + ",resizable=" + "1";
  21. varStore = varStore + ",scrollbars=" + "0";
  22. varStore = varStore + ",menubar=" + "0";
  23. varStore = varStore + ",toolbar=" + "0";
  24. varStore = varStore + ",directories=" + "0";
  25. varStore = varStore + ",location=" + "0";
  26. varStore = varStore + ",status=" + "1";
  27. varStore = varStore + ",left=" + windowLeft;
  28. varStore = varStore + ",top=" + windowTop;
  29. varStore = varStore + ",ScreenX=" + windowLeft;
  30. varStore = varStore + ",ScreenY=" + windowTop;
  31. window.open(url,theName,varStore)
  32. }
  33. else
  34. {
  35. theName.focus();
  36. }
  37. }
  38. //-->
  39. </SCRIPT>
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,616
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 466
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Parent/Child Windows

 
0
  #13
Aug 2nd, 2007
So maybe next time you should place the entire requirement instead of letting us guess whether you want 2 or 3 windows....

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <script>
  4. var wnd = new Array();
  5.  
  6. function openit(id)
  7. {
  8. if(!wnd[id] || wnd[id].closed)
  9. wnd[id] = window.open("http://www.google.com");
  10. else
  11. wnd[id].focus();
  12. }
  13. </script>
  14. </head>
  15. <body>
  16. <form>
  17. <input type="button" value="Open1" onclick="openit(0);" /><br/>
  18. <input type="button" value="Open2" onclick="openit(1);" /><br/>
  19. <input type="button" value="Open3" onclick="openit(2);" /><br/>
  20. </form>
  21. </body>
  22. </html>
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 13
Reputation: JC4QLx3 is an unknown quantity at this point 
Solved Threads: 0
JC4QLx3 JC4QLx3 is offline Offline
Newbie Poster

Re: Parent/Child Windows

 
0
  #14
Aug 3rd, 2007
I want to thank you, albeit you were not very friendly, you did continue to help me through creating a successful script. I finally narrowed down the problem to the code regarding the varible for the window attributes (see earlier samples). You did not include that in your second working sample. Normally that code works fine, but not with the code you created. Thanks again!

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <script>
  2. var wnd = new Array();
  3.  
  4. function openWindow(url,id)
  5. {
  6. if(!wnd[id] || wnd[id].closed)
  7.  
  8. wnd[id] = window.open(url,"","width=screen.availWidth,height=screen.availHeight,resizable=1,scrollbars=0,menubar=0,toolbar=0,directories=0,location=0,status=1,left=0,top=0,ScreenX=0,ScreenY=0");
  9.  
  10. else
  11.  
  12. wnd[id].focus();
  13. }
  14. </script>
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,616
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 466
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Parent/Child Windows

 
0
  #15
Aug 3rd, 2007
The code you pasted above seems to be working for me. What problems do you experience?

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <script>
  4. var wnd = new Array();
  5. function openWindow(url,id)
  6. {
  7. if(!wnd[id] || wnd[id].closed)
  8. wnd[id] = window.open(url,"" + id, "width=" + screen.availWidth +
  9. ",height=" + screen.availHeight +
  10. ",resizable=1,scrollbars=0,menubar=0,toolbar=0,directories=0," +
  11. "location=0,status=1,left=0,top=0,ScreenX=0,ScreenY=0");
  12. else
  13. wnd[id].focus();
  14. }
  15. </script>
  16. </head>
  17. <body>
  18. <input type="button" value="Button1" onclick="openWindow('http://www.google.com', 1);" />
  19. <input type="button" value="Button2" onclick="openWindow('http://www.google.com', 2);" />
  20. <input type="button" value="Button3" onclick="openWindow('http://www.google.com', 3);" />
  21. </body>
  22. </html>
Last edited by ~s.o.s~; Aug 3rd, 2007 at 12:44 pm.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 13
Reputation: JC4QLx3 is an unknown quantity at this point 
Solved Threads: 0
JC4QLx3 JC4QLx3 is offline Offline
Newbie Poster

Re: Parent/Child Windows

 
0
  #16
Aug 3rd, 2007
No problem at all. Yes, it works very well. I was simply thanking you and informing you of our success with the code.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,616
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 466
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Parent/Child Windows

 
0
  #17
Aug 4th, 2007
Glad I could be of some help.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC