PDA

View Full Version : onMouseOver, onMouseOut, onClick



rsines
02-08-2008, 03:23 PM
I know this is a dumb question for those that are experienced in writing JavaScripts, but to a novice like myself it seems impossible.
I have tried for the past three days, and all I get is one error after another.

The following line works as is:
calendarString += '<td align=\"center\" valign=\"center\"><a href=\"javascript:changedate(\'return\')\"><b>Today<\/b><\/a><\/td>';

How can the above line be changed to use images instead of text?

onMouseOver="on.jpg"
onMouseOut="off.jpg"
onClick=" "

I found this works also (I figured it out after making this post):

calendarString += '<td align=\"center\" valign=\"center\"><a href=\"#\" onMouseOver=\"document.myVar.src=\'on\.jpg\';\" onMouseOut=\"document.myVar.src=\'off\.jpg\';\" onClick=\"changedate(\'return\')\"><img name=\"myVar\" src=\"off\.jpg\"\/><\/a><\/td>';

jscheuer1
02-08-2008, 04:01 PM
calendarString += '<td align="center" valign="center"><a href="#" '+
'onclick="changedate(\'return\');return false;"><img src="off.jpg" border="0" '+
'onmouseover="this.src=\'on.jpg\';" onmouseout="this.src=\'off.jpg\';"><\/a><\/td>';

or:


calendarString += '<td align="center" valign="center"><img src="off.jpg" '+
'onclick="changedate(\'return\');" '+
'onmouseover="this.src=\'on.jpg\';" onmouseout="this.src=\'off.jpg\';"><\/td>';

or:


calendarString += '<td align="center" valign="center"><img '+
'style="cursor:pointer;" src="off.jpg" onclick="changedate(\'return\');" '+
'onmouseover="this.src=\'on.jpg\';" onmouseout="this.src=\'off.jpg\';"><\/td>';