View Single Post
  #5 (permalink)  
Old Apr 2nd, 2007, 16:52
spinal007's Avatar
spinal007 spinal007 is offline
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,650
Blog Entries: 1
Thanks: 0
Thanked 4 Times in 4 Posts
Re: how to load a different image on a web page and attach a hyperlink

No problem and well done for trying and getting there! I hope you stick around and enjoy Webforumz...

I'll post my reply anyway because this might help somebody who comes across this post in the future.

This is an array...
['Joy_gr-jaune_ico.jpg',170,170,'Industrial Joysticks']

You went wrong by putting url= in the array...
['Joy_gr-jaune_ico.jpg',170,170,'Industrial Joysticks', url= 'NEW 1'] // ERROR

Add items to an array like this...
['Joy_gr-jaune_ico.jpg',170,170,'Industrial Joysticks', 'NEW 1', 'NEW 2']

In your case, the index of 'NEW 1' is 4 (as it's the 5th item of the array).
So you can access it using [4].

Which in your case, would be:
document.write('<p class="h"><a href="'+a[cflip][4]+'
">
<img src="'+a[cflip][0]+'" width="'+a[cflip][1]+'" height="'+a[cflip][2]+'" alt="'+a[cflip][3]+'"><br>'+a[cflip][3]+'<\/a><\/p>');
Reply With Quote