Microsoft
Software
Hardware
Network
Question : Replacing broken images (javascript on error in php)
There are some broken images on my site, I would like to replace them with an on error statement and my own image if an image is broken. I have been trying following code but there seems to be some sort of syntax error. Is there a different way?
<?php
...
echo '<a href="'.$n_nearby.'"><img src="'.$img.'" onError="this.src='/images
/error.gif
'" /></a><br />
1: 2: 3: 4:
Original code: <?php ... echo '<a href="'.$n_nearby.'"><img src="'.$img.'" /></a><br />
Answer : Replacing broken images (javascript on error in php)
try this: This will work for you.
$$('img').each(function(el
e){
ele.addEvent('error', function(){
ele.set('src','path to defalut image');
});
});
Hope this helps
Addy
Random Solutions
Find Label in Datalist within Gridview
how to use iscsi from backup exec with Dell TL2000
Documents Folder redirection on server 2008 R2 remote desktop services in SBS 2003 domain
MSExchange ActiveSync Event ID 1040 Annoying?!
Microsoft Outlook 2007 is pulling duplicate emails from free hotmail live server - how can I prevent this, its driving me mad.
Should Sys Admins (Domain Admins) also have user accounts?
checking login & pass with curl
PL/SQL - how to dynamically retrieve next 5 years from sysdate
Auto start and mount RAID array Linux
Access VBA - best way to get field value based on ID