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: javascript help

  1. #1
    New to the CF scene
    Join Date
    Jul 2003
    Location
    Orlando, FL
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    javascript help

    I hope someone out there can help me...
    I am building a website (not published yet) and have one particular page that has got several graphics in a table (I use FP2002) and I am trying to code the javascript to open each one when they are clicked on individually - with the following script:

    <script>

    //Popup Window Script
    //By JavaScript Kit (http://javascriptkit.com)
    //JavaScript tutorials and over 400+ free scripts

    function openpopup(){
    var popurl="o-d-penny-copper.htm"
    winpops=window.open(popurl,"","width=340,height=200,resizable,")
    }

    </script>

    The first pop-up works fine, but is the same graphic on all five, no matter which one is clicked on. When I add a semicolon and another url or anything to the "var popurl line" then nothing works. I get "The page cannot be displayed".

    What am I doing wrong? Please help.

  • #2
    Regular Coder
    Join Date
    Apr 2003
    Location
    Northern California
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well Im kinda not following you completly but you should use an array try this
    Code:
    <script language="javascript" type="text/javascript">
    
    //Popup Window Script
    //By JavaScript Kit (http://javascriptkit.com)
    //JavaScript tutorials and over 400+ free scripts
    var popUrls=["http://ww.whatever1.com",""http://ww.whatever2.com","http://ww.whatever3.com","http://ww.whatever4.com"]
    
    function openpopup(index){
    winpops=window.open(popUrls[index],"","width=340,height=200,resizable,")
    }
    
    </script>
    
    <img src="img1.jpg" onclick="openpopup(0)"/>
    <img src="img2.jpg" onclick="openpopup(1)"/>
    <img src="img3.jpg" onclick="openpopup(2)"/>
    <img src="img4.jpg" onclick="openpopup(3)"/>

  • #3
    New to the CF scene
    Join Date
    Jul 2003
    Location
    Orlando, FL
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Scriptkeeper, I'll thy that and see if it works. If so, great; if not, I will post to this thread again w/ the new script used. Thanks again...


  •  

    Posting Permissions

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