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
PHP - session variables lost between subfolders
Creating Visual Studio 2008 Development Environment for Sharepoint 2007 Sequential Workflows
i need a regexp which eliminate all what's not a number or a ";"
Microsoft WORD doesnt open full screen
MS Access Data Import
How to change Hotsname and ipaddress of Oracle Databse server
How do I count the number of characters in the attached php function and send alert message?
How to disable form fields in Coldfusion flash form by clicking a checkbox?
Login to SSRS as andmistrator rather than anonymous user.
jQuery ajax update multiple fields