malhyp
08-07-2008, 03:41 AM
Hi there, can anyone let me know how to add an "ALT" tag to this bit of javascript?
myimages[1]="html/images/cat-image-10.jpg"
Cheers
myimages[1]="html/images/cat-image-10.jpg"
Cheers
|
||||
Add "ALT" attribute to javascriptmalhyp 08-07-2008, 03:41 AM Hi there, can anyone let me know how to add an "ALT" tag to this bit of javascript? myimages[1]="html/images/cat-image-10.jpg" Cheers ninnypants 08-07-2008, 03:43 AM This will do it myimages[1].alt = "this is alt text"; rangana 08-07-2008, 03:43 AM myimages[1].setAttribute('alt','whatever'); If nothing worsk, show us the rest of the script. Sorry ninnypants. malhyp 08-07-2008, 06:56 AM Ok, do I combine it in one line or two? E.g. myimages[1]="html/images/cat-image-10.jpg", "setAttribute('alt','whatever')"; or like this myimages[1]="html/images/cat-image-10.jpg", myimages[1].setAttribute('alt','Cat Image 10'); myimages[2]="html/images/cat-image-11.jpg", myimages[2].setAttribute('alt','Cat Image 11'); Cheers rangana 08-07-2008, 07:08 AM The later should work, except you need to replace the comma ( , ) with colon ( ; ): myimages[1]="html/images/cat-image-10.jpg"; myimages[1].setAttribute('alt','Cat Image 10'); myimages[2]="html/images/cat-image-11.jpg"; myimages[2].setAttribute('alt','Cat Image 11'); If nothing helps, up a link or show to us the rest of the script. abduraooft 08-07-2008, 07:49 AM myimages[1]="html/images/cat-image-10.jpg", If you are assigning the src attribute, the above should be myimages[1].src="html/images/cat-image-10.jpg"; EM Mudder 10-07-2011, 07:03 PM I'm having the same trouble with adding an ALT tag to the last image: var imageList = [ "images/banner/banner1.jpg", "images/banner/banner2.jpg", "images/banner/banner3.jpg", "images/banner/banner4.jpg", "images/banner/banner4.jpg", ]; Can anyone help? Philip M 10-07-2011, 07:48 PM "images/banner/banner4.jpg", "images/banner/banner4.jpg", banner5.jpg??? But please do not hijack ancient and long-resolved threads - prefer to start a new thread of your own with an appropriate and helpful title. All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit. |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum