| javascript - popup windows multiple popups on one page |
lachtzu

msg:958600 | 7:23 pm on Mar 3, 2003 (gmt 0) | I know very little about javascript, but really 'need' to use popup windows on a site I'm designing to save space. I copied some code from a jscript tutorial site, and it worked fine when there was only one pop up on the page. But now that I've created several popups for the page, only one of them gets displayed for all the buttons on the page. I think there is a variable that is being set in the loadwindow function that is affecting this, but don't know much beyond that. here's what the code snippet looks like: <script> function loadwindow(){ window.open("Pop_up1.html","","width=400,height=350,status=1") } </script> <form><input type="button" onClick="loadwindow()" value="See Description"></form> <<new row, cell, etc.>> <script> function loadwindow(){ window.open("Pop_up2.html","","width=400,height=350,status=1") } </script> <form><input type="button" onClick="loadwindow()" value="See Description"></form> The problem is that its loading Pop_up2.html for both buttons. I know I need to actually learn this stuff and I'm trying the easy way out, but just this once please help! :)
|
hakre

msg:958601 | 7:30 pm on Mar 3, 2003 (gmt 0) | hi lachtzu, in your code, the main mistake is to define the function loadwindow() two times. if you locate the second definition of the function, just add a '2' to the functions name (it will then be loadwindow2()), and do so in the second button which then will open the 2nd popup window.
|
jatar_k

msg:958602 | 7:32 pm on Mar 3, 2003 (gmt 0) | maybe pass the pagename to the function function loadwindow(page){ window.open(page,"popup","width=400,height=350,status=1") } <input type="button" onClick="loadwindow('Pop_up1.html')" value="See Description"> <input type="button" onClick="loadwindow('Pop_up2.html')" value="See Description">
|
lachtzu

msg:958603 | 8:04 pm on Mar 3, 2003 (gmt 0) | and the winner is...Hakre! I'm sure both work - in this case naming the functions separately was very easy and quick. Thanks
|
|
|