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
    Apr 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript link within Javascript Generator

    I wrote a javascript a long time ago that randomly generates 5 images with specified links, but is coded so it doesnt repeat any of the images. Its quite useful, I will share if people wish.

    However the original array was:
    theImages[0] = "<a target='_blank' href='http://www.google.com/'><img src='images/google.gif' alt='google'></a>";

    What i was trying to do today was:
    theImages[0] = "<a href='javascriptopUp('images/full/paul1.jpg')'><img src='images/prev1.gif' id='midimg'></a>";

    I have a pop-up script running on the site already - but nothing happens. the pop-up script is fine. the images get called by the generator but the links don't work.

    I am very rusty at JS and don't have my books anymore. I would appreciate if somone could give me a shunt in the right direction!

  • #2
    New Coder
    Join Date
    Apr 2005
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The problem is that the href=' is opened by a single quote, and you closing it again with ('... so you should change one of the two, I should go for this one:

    Code:
    theImages[0] = "<a href='javascriptopUp(\"images/full/paul1.jpg\")'><img src='images/prev1.gif' id='midimg'></a>";

  • #3
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Worked like a charm!

    Thanks.


  •  

    Posting Permissions

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