Instead of using the name attribute on the <img>
, I would start by recommending you use the id
attribute, as follows:
<img id="crt" />
Then you can change the src
as follows:
document.getElementById('crt').src = 'images/addcrt_btn_dn.png';
Make sure you properly escape all those quotes properly, or work on generating the content another way (here's an example sticking with the name
attribute):
...
?>
<a href="catalog.php?buyproduct=<?php=$productNumber?>" onmouseover="document[crt].src='images/addcrt_btn_dn.png'" onmouseout="document[crt].src='images/addcrt_btn.png'">
<img src="images/addcrt_btn.png" name="crt" alt="Add to cart" width="81" height="24">
</a>
<?php
...
Dolph
2010-01-23 07:04:15