faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 3 people (67%) answered Yes
Recently 2 of 3 people (67%) answered Yes

Entry

How can I find the src of an image so I can do a comparison? (Ex: if (img.src=="error.gif")...)

Apr 6th, 2008 19:37
ha mo, jsWalter, J M,


First, you need an ID for your IMG object.
Then you can use your IF statment, just change it from 'img.scr. 
to 'myID.scr'
Also, what will be returned will not be *just* the file name, but the 
complete URL to the image.
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com