...

View Full Version : Javascript links don't work



martin_b14
07-20-2010, 11:56 PM
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

Old Pedant
07-21-2010, 12:26 AM
Ready to kick yourself?

Look here:


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?

Old Pedant
07-21-2010, 12:28 AM
<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.

martin_b14
07-21-2010, 12:39 AM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum