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
Redistributing RIP into OSPF non-contiguous subnets.
Unable to Save files in my C drive
How to select all child DIVs except where class=...
How to get past login page strRequestHTML Post
How secure is an HTTP XML Request?
Configuring QoS on Linksys Cisco IP VOIP phone system through residential ADSL2
Custom Shortcut Menus in MS Access 2007
OS Logs On and then Immediately Logs Off
windows 2008 r2 with raid 6
procmon.pmb is 38GB and growing