Jump to content

Replacing Broken images.


colleyboy

Recommended Posts

Ok mixing javascript with php.... im having bugs :(.

 

I basically want to replace any broken image links with a picture "noimage.gif" in the images folder.

 

I tried this code but am getting the error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/wormste1/public_html/tilburywebdesign/shop/FTPServers/barryottley/showroom.php on line 78

 

This is the javascript header - all seems fine:

<script language="JavaScript" type="text/javascript">

function ImgError(source){ 
    source.src = "/images/noimage.gif"; 
    source.onerror = ""; 
    return true; 
} 


</script>

 

this is the code thats erroring... is it the way ive written in the code into the IMG tag?

 

while($row = mysql_fetch_array($result)){
echo "<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH=100% BORDER=0>";
echo "<TR />";
echo "<TD WIDTH=30% VALIGN=TOP />";
echo " <A HREF='images/".$row['photo']."' target=_blank><IMG SRC='images/".$row['photo']."' width=186 height=155 border=0 onerror="ImgError(this);" /></A> ";
echo "<br />";
echo "</TD>";
echo "<TD WIDTH=10 VALIGN=TOP />";

 

 

Link to comment
https://forums.phpfreaks.com/topic/213865-replacing-broken-images/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.