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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.