Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Multiple Popups

  1. #1
    Regular Coder
    Join Date
    Jan 2005
    Posts
    189
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Multiple Popups

    Here's what I'm trying to do:

    I've got 14 icons, and each links to a javascript window with an html page in it.

    I can't figure out how to get each popup window to have seperate content in it though.

    Here's my code so far, I've tried to setup 2 popups to seperate pages:

    Code:
    var a;
    	function popup()
    	{
    	a=window.open("samples/sample01.html","sample01","location=0,menubar=0,height=420,width=540,scrollbars=0,status=0,resizable=0,toolbar=0,directories=0");
    	}
    var b;
    	function popup()
    	{
    
    	b=window.open("samples/sample02.html","sample02","location=0,menubar=0,height=420,width=540,scrollbars=0,status=0,resizable=0,toolbar=0,directories=0");
    	}
    When I click the links on my page, both icons go to the same file sample02.html (so obviously i'm doing something wrong).

    My links from the html are simply: (so that should be fine I think)
    Code:
    <a href="samples/sample01.html" onclick="javascript:popup();return false;">
    <a href="samples/sample02.html" onclick="javascript:popup();return false;">

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,534
    Thanks
    3
    Thanked 512 Times in 499 Posts
    your 2 functions must have unique names as only the last one is being called at the moment

    and see
    http://www.vicsjavascripts.org.uk/Po...pGenerator.htm

  • #3
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    	function popup(URL)
    	{
    	a=window.open(URL,"sample","location=0,menubar=0,height=420,width=540,scrollbars=0,status=0,resizable=0,toolbar=0,directories=0");
    	}
    
    
    
    
    <a href="samples/sample01.html" onclick="popup(this.href);return false;">
    <a href="samples/sample02.html" onclick="popup(this.href);return false;">
    .....Willy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •