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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Help with a Script from this site

    I need to have a new window or tab to open for the random image w/link script found here http://javascriptkit.com/script/cut144.shtml

    I have tried target=blank but that doesn't work. Your help would be appreciated.

    Thank you

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,919
    Thanks
    79
    Thanked 4,423 Times in 4,388 Posts
    WHEN is the new window supposed to open?

    When the main page first loads? When the user clicks on something?

    CAUTION: If you want it to happen when the page first loads, most popup blockers will block it. Most blockers only allow popups that happen because of human interaction.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Regular Coder
    Join Date
    Sep 2011
    Posts
    103
    Thanks
    0
    Thanked 14 Times in 14 Posts

  • #4
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hi

    When clicking on the random image, I would like the link destination to open in a new window or tab instead of "On Top" as the code currently stands

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,919
    Thanks
    79
    Thanked 4,423 Times in 4,388 Posts
    Oh, is that all.

    Trivial.

    Code:
    document.write('<a href="' + imagelinks[ry]+ '" target="_blank"><img src="'+myimages[ry]+'" border=0></a>');
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    Gramps (10-05-2011)

  • #6
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    LOL easy when you know Thanks that did it!

    Quote Originally Posted by Old Pedant View Post
    Oh, is that all.

    Trivial.

    Code:
    document.write('<a href="' + imagelinks[ry]+ '" target="_blank"><img src="'+myimages[ry]+'" border=0></a>');


  •  

    Posting Permissions

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