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
WiFi / wireless connection dropped & laptops need to be rebooted to reconnect to 2Wire broadband modem : Event id 5005
Coldfusion -SQL and LIKE question
Difference between Icefaces,myfaces,richfaces
in JSF?
Ubuntu - Convert Desktop Hard Drive to Laptop? Just ext4 format and copy all files?
Can't locate DBI.pm in @INC
Excel/csv, move rows to another sheet based on changing value in column
WHAT IS PROTEGE?
Send Mail Using gmail pop3 in VB.Net
Auto Send Excel as Email Attachment
How to solve incompatible types error in TableSorter.java?