This is a discussion on "how to load a different image on a web page and attach a hyperlink" within the JavaScript Forum section. This forum, and the thread "how to load a different image on a web page and attach a hyperlink are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
how to load a different image on a web page and attach a hyperlink
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Hello,
I am looking for code that will load different image on a web page and attach a hyperlink to each picture and if possible have a read artilce link associated with the image. I did find some code that let me load the images but i can not associate a link with it.
Last edited by karinne; Mar 30th, 2007 at 19:22. Reason: Please use [code]...[/code] tags when displaying code! |
|
|
|
||||
|
Re: how to load a different image on a web page and attach a hyperlink
add link tags around the code....
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
Re: how to load a different image on a web page and attach a hyperlink
Thank you
when i click on the picture it want's to go to url.htm how do i customize the line ['Joy_gr-jaune_ico.jpg',170,170,'Industrial Joysticks', url='joystick_news.html'], looking foward to your reply |
|
|||
|
Re: how to load a different image on a web page and attach a hyperlink
Spinal007,
I figured it out, never would of got without you Thank you |
|
||||
|
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>');
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
![]() |
| Tags |
| different, hyperlinks, images, web papes |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Page Load Issue | kathyc | JavaScript Forum | 1 | Jun 13th, 2008 02:21 |
| Load part of a page. | magiccupcake | Web Page Design | 8 | Jun 23rd, 2007 11:44 |
| How to use a javascript variable to load an image | VanderBOOM | JavaScript Forum | 2 | Nov 13th, 2006 14:00 |
| A hyperlink that passes a variable to a page | oz_egirl | Classic ASP | 1 | Jan 18th, 2006 16:23 |
| image as hyperlink question | bklcomputing | Web Page Design | 2 | May 20th, 2005 06:56 |