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
NTLDR is Missing on HP Proliant ML350 G4 with Windows 2003 SP2
HP Laptop w/ Vista freezing regularly
How do I verify Using SSIS if an XML file exist in the folder , change it's name and move ot to an SFTP if exist
backup exec 2010 on esxi
Google Analytics
Blackberry browser 400 error - socketexception Connection reset
Best way to handle vanity urls in IIS?
ISA2006 - Register VPN-Clients with DNS
SQL Encryption Key Error - SQL 2005
SBS Certificate Idea ... I may be wrong