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

    Javascript links don't work

    Hi Everyone,

    I have a strange problem that I can't resolve.

    Have a look at www.snaptease.co.uk/random.html and you will see a random image every time you refresh.

    Now look at www.snaptease.co.uk/random1.html and you won't see the image. The only difference is in the js/random.js and js/random1.js each file references.

    js/random.js uses the same html link to index.html
    js/random1.js links to individual html files that exist and valid.

    The working code looks like this:
    [CODE] images[0] = "<a href = 'index.html'><img src='images/games/aa01q.jpg' alt='album art' title='Do you recognise this album?'></a>";[CODE]

    The non working code looks like this:
    [CODE] images[0] = "<a href = 'answers/aa01.html'><img src='images/games/aa01q.jpg' alt='album art' title='Do you recognise this Album?'></a>";[CODE]

    Even if I enter the full url it makes no difference.

    Please tell me what I am doing wrong and how to fix it.

    I've been banging my head over this for a while now so I would appreciate any help.

    Thanks in advance

    Martin

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,554
    Thanks
    80
    Thanked 4,620 Times in 4,583 Posts
    Ready to kick yourself?

    Look here:
    Code:
    images[159] = "<a href = 'answers/ww06.html'><img src='images/games/ww06q.jpg alt='where in the world' title='Where was this picture taken?'></a>";
    images[160] = "<a href = 'answers/ww07.html'><img src='images/games/ww07q.jpg alt='where in the world' title='Where was this picture taken?'></a>";
    images[161] = "<a href = 'answers/ww08.html'><img src='images/games/ww08q.jpg alt='where in the world' title='Where was this picture taken?'></a>";
    images[162] = "<a href = 'answers/ww09.html'><img src='images/games/ww09q.jpg alt='where in the world' title='Where was this picture taken?'></a>";
    What's missing?

    HINT: Count the apostrophes in each line of code. You *must* come up with an even number, right?
    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
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,554
    Thanks
    80
    Thanked 4,620 Times in 4,583 Posts
    Code:
    <img src='images/games/ww06q.jpg alt='where in the world' title='Where was this picture taken?'>
    In other words, I doubt seriously that you have a file by that name (in red) on the server.
    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:

    martin_b14 (07-21-2010)

  • #4
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    You got it,

    I think it's called "Can't see the wood for the trees". I was so occupied with looking at the link I didn't notice most of the images had apostrophes missing.

    Thank you so much

    Regards

    Martin


  •  

    Tags for this Thread

    Posting Permissions

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