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
  1. #1
    New to the CF scene
    Join Date
    May 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HI GUYS! Can anyone help me with this...

    HOW CAN I MAKE THE IMAGE LINKS -WHILE USING THE SCRIPT BELOW- POP UP IN A SEPARATE WINDOW??

    I TRIED TO ADD SOME target="_blank" IN THERE BUT... THAT DOESNT WORK!
    PLEASE SOMEONE! THAT MUST BE SIMPLE... BUT I CANT FIGURE IT OUT!!

    THANKS,
    GIRLY GEEK


    Random Image Link
    A script that loads a random image with the corresponding link. Supports unlimited images.
    http://www.javascriptkit.com/script/cut144.shtml
    Description: This is a robust script that loads a random image with corresponding link. You can throw in as many images into rotation as you wish.



    <script language="JavaScript">
    <!--

    /*
    Random Image Link Script- By JavaScript Kit(http://www.javascriptkit.com)
    Over 200+ free JavaScripts here!
    Updated: 00/04/25
    */

    function random_imglink(){
    var myimages=new Array()
    //specify random images below. You can have as many as you wish
    myimages[1]="image1.gif"
    myimages[2]="image2.gif"
    myimages[3]="image3.gif"
    myimages[4]="image4.gif"
    myimages[5]="image5.gif"
    myimages[6]="image6.gif"

    //specify corresponding links below
    var imagelinks=new Array()
    imagelinks[1]="http://www.javascriptkit.com"
    imagelinks[2]="http://www.netscape.com"
    imagelinks[3]="http://www.microsoft.com"
    imagelinks[4]="http://www.dynamicdrive.com"
    imagelinks[5]="http://www.freewarejava.com"
    imagelinks[6]="http://www.cnn.com"

    var ry=Math.floor(Math.random()*myimages.length)
    if (ry==0)
    ry=1
    document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=0></a>')
    }
    random_imglink()
    //-->
    </script>

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Have you tried it like this:
    Code:
     document.write('<a href='+'"'+imagelinks[ry]+'" target="_blank"'+ '><img src="'+myimages[ry]+'" border=0></a>')
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #3
    New to the CF scene
    Join Date
    May 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Working, yesss

    Oh wow! It works!
    Thank you so much - rangana!!

    I appreciate a lot


  •  

    Posting Permissions

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