Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple pop-up windows 1

Status
Not open for further replies.

monstermash

Technical User
Aug 15, 2000
18
0
0
US
Hello,<br><br>&nbsp;&nbsp;&nbsp;This is my first visit to this forum. I hope someone can help me. I have 2 or more buttons on 1 page that should bring up different pop-up windows. When I originally had just 1 button on a page that brought up a pop-up window, I could get it to work fine....here is my code...<br><br>&lt;script LANGUAGE=&quot;JavaScript&quot;&gt;<br>function newWin(&quot;contactlist.html&quot;,&quot;contact&quot;,&quot;height=450,width=250,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,left=0,right=0,top=0&quot;){<br>var newWin=window.open(&quot;contactlist.html&quot;,&quot;contact&quot;,&quot;height=450,width=250,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,left=0,right=0,top=0&quot;)<br>}<br>&lt;/script&gt;<br>&lt;script LANGUAGE=&quot;javascript&quot;&gt;<br>function newWin(&quot;statistics.html&quot;,&quot;stat&quot;,&quot;height=250,width=625,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,left=0,right=0,top=0&quot;){<br>var newWin=window.open(&quot;statistics.html&quot;,&quot;stat&quot;,&quot;height=250,width=625,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,left=0,right=0,top=0&quot;)<br>}<br>&lt;/script&gt;<br><br>Can anyone tell me what I need to change to make my 2 different buttons bring up these 2 different pop-up windows. The buttons are in Flash if that makes any difference. Thanks for the help.
 
My guess is that you have to changes the second function name.&nbsp;&nbsp;Functions must not have the same name, if they do I believe that only the first occurance of that function will be called.<br><br>Hope this helps!
 
I thought my first function name was &quot;contact&quot; and my second function name was &quot;stat&quot;? Am I incorrect. Do I need to have the opening and closing javascript tags for both scripts? I am a little new at this. Thank you.
 
No, you can have both functions under the same script tag.&nbsp;&nbsp;Just call them by name.&nbsp;&nbsp;eg)<br><br>onClick=&quot;stat()&quot;<br><br>or<br><br>onClick=&quot;newWin()&quot;<br><br>
 
Thank you very much for your quick reply. I will try to implement your suggestion now.
 
I tried all of these and none will work. Do you know what I am doing wrong?<br><br>javascript:eek:nClick=window.open(&quot;contact()&quot;)<br>javascript:window.open('stat') <br>and...onClick&quot;stat()&quot;
 
I guess I should have been more specific.<br><br>You said that when a button is click, these new windows have to come up, then you need the onClick event of the button.<br><br>eg)<br><br>&lt;input type=&quot;Button&quot; name=&quot;Click Me!&quot; onClick=&quot;stat()&quot;&gt;<br><br>This uses the onclick event of the button to call the specified function!
 
Where is the function name determined? Is it not &quot;stat&quot; and &quot;contact&quot;?
 
I figured it out! Yay. Sorry for all my confusion. Your input was quite valuable, thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top