Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change image src in mouseover in javascript.

Status
Not open for further replies.

cote

IS-IT--Management
May 17, 2002
10
0
0
US
HELLLLLLLLLLLLLLLLLLPPPPPPPP!

I'm trying to change the source image file onmouseover event, but doesn't work. Here's the code. I think the problem is with the " and ' in the mouseOver and MouseOut command. The code works when I eliminate the Mouse events.

<script language=&quot;javascript1.2&quot;>
document.write('<img src=&quot;images/' + carimg[1] + 'onMouseOver=&quot;this.src='images/' + carimg[2] + '&quot; onMouseOut=&quot;this.src='images/' + carimg[1] + ''&quot;>');

</script>
 
try now
<script language=&quot;javascript1.2&quot;>
document.write('<img src=&quot;images/' + carimg[1] + '&quot; onMouseOver=&quot;this.src=\'images/' + carimg[2] + '\'&quot; onMouseOut=&quot;this.src=\'images' + carimg[1] + '\'&quot;>');
</script> ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
Thanks for the quick reply. It works in IE but not in Netscape. Do you know or can anybody help me how to make it work in Netscape?

Thanks in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top