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
Unable to access certain domains
Is there a way to use the recovery partition to reinstall the OS if the drive won't boot or put it on a new hard drive?
XP Pro SP 3 - Ordinal 423 could not be located in the dynamic link library urlmon.dll
Restoring a Dell studio 1535 to factory default
Sort columns in pivot table.
Remote Desktop Connection to Windows SBS 2008
how can i uninstall powerHA hacmp fileset from unix aix server
set virtual host on Apache2.2 and PHP 5.3
Cannot renew IP address on WinXP
Router Sessions