Current location: Hot Scripts Forums » General Web Coding » JavaScript » how many javascript popup windows..


how many javascript popup windows..

Reply
  #1 (permalink)  
Old 12-30-03, 09:20 PM
epic1231 epic1231 is offline
Newbie Coder
 
Join Date: Sep 2003
Location: NJ
Posts: 80
Thanks: 0
Thanked 1 Time in 1 Post
how many javascript popup windows..

how many javascript popup's can i make for one page? I have a bottom menu bar where i have serveral options for users to select.. I had added the code for each script but now only one window popup's for each of them.

Here is the code i have

Code:
 
<script>

function openpopup(){
var popurl="http://www.games4dummies.com/newsletter/newsletter.php"
winpops=window.open(popurl,"","width=400,height=338,")
}

      </script>

<a href="javascript:openpopup()" style="text-decoration: none">
      <font color="#000000">Newsletter</font></a> 
      | <script>

function openpopup(){
var popurl="http://www.games4dummies.com/tell/form.html"
winpops=window.open(popurl,"","width=400,height=338,")
}

      </script>

<a href="javascript:openpopup()" style="text-decoration: none">
      <font color="#000000">Tell-A-Friend</font></a> 

    <script>

function openpopup(){
var popurl="http://www.games4dummies.com/TOS.html"
winpops=window.open(popurl,"","width=800,height=600,")
}

      </script>

<a href="javascript:openpopup()" style="text-decoration: none">
      <font color="#000000">Terms-of-Service</font></a></font> </TD>
but for some reason only the last window TOS.html popup's for each of them - is there a way to set it up so that i can have these three popup

Thanks,
Bill
Reply With Quote
  #2 (permalink)  
Old 12-30-03, 09:52 PM
blaw's Avatar
blaw blaw is offline
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Hi there,

I guess the problem is that you have the same window handler name for all the popups.

You have winpops for all the subwindows you are trying to open.

The reason why you got the last one only is that it is excuted sequentially and as a result, one popup gets replaced with another, and so forth, and the last one did not get replaced by another, and thus, you see the last one only.

Hope this helps.
__________________
Blavv =|
Reply With Quote
  #3 (permalink)  
Old 12-30-03, 10:06 PM
epic1231 epic1231 is offline
Newbie Coder
 
Join Date: Sep 2003
Location: NJ
Posts: 80
Thanks: 0
Thanked 1 Time in 1 Post
ok that definitly makes sense - but can i change that or should i search around for two other java popup codes to place in there so i have three different ones?

Thanks for the reply - happy holiday's
Bill
Reply With Quote
  #4 (permalink)  
Old 12-31-03, 02:14 AM
blaw's Avatar
blaw blaw is offline
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Hi there,

I see you have functions for each popup.

You can actually defnie all your functions within <head> tags like the following and call them from the body:

Code:
<script type="text/javascript">

function myFunc1() {
      // your statement 1.
}

function myFunc2() {
      // your statement 2.
}

function myFunc3() {
      // your statement 3.
}

</script>
In regards to your question, yes, you can change the name of the subwindow, AS WELL AS the function's names, but it seems like you can use one function and pass URLs or width or other parameters to that function and do the same thing.

I'll have to go out now, but if I have time when I'm abck, I'll give you a little more details on this.

Sorry, gotta run. Good night!
__________________
Blavv =|
Reply With Quote
  #5 (permalink)  
Old 12-31-03, 12:43 PM
epic1231 epic1231 is offline
Newbie Coder
 
Join Date: Sep 2003
Location: NJ
Posts: 80
Thanks: 0
Thanked 1 Time in 1 Post
no problem it worked great - i understand a bit better now how it was all calling the same window now it can determine which window for which popup

thanks for your help
Reply With Quote
  #6 (permalink)  
Old 12-31-03, 06:01 PM
blaw's Avatar
blaw blaw is offline
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Oh okay, that's good. Learning is always good. =)

If you need any more assistance, feel free to post it here. I or someone else will assist you...
__________________
Blavv =|
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reaaly stuck about javascript over frames muratisik JavaScript 1 12-14-03 11:58 AM
Popup window on the top of other windows Nia ASP 1 11-05-03 11:35 AM
Matrix Reseller - Windows 2003 and FreeBSD vortech General Advertisements 0 11-02-03 10:06 PM
Forcing a JavaScript to abort HiMyNameIs JavaScript 3 09-18-03 10:23 AM


All times are GMT -5. The time now is 11:39 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.