onmouseover help!

AdvancedRobotics

Senior member
Jul 30, 2002
324
0
0
Okay, I am pretty sure there is a javascript (I've seen it before) to do this. Basically, I don't want to have to keep on typing: onmouseover="this.style.backgroundColor='#ffffff'" onmouseout="this.style.backgroundColor='#333333'"

I'm pretty sure there is a javascript that goes something like this:

<script language="javascript">
function = on()
{
elem.style.backgroundColor="#ffffff"
}

function = off()
{
elem.style.backgroundColor="#333333"
}
</script>

then you can just type: onmouseover="on()" onmouseout="off()"

This would save me a lot of time... So am I correct that you can do something llike this? And is this javascript correct?

Thanks!
 

joinT

Lifer
Jan 19, 2001
11,172
0
0
Why not use CSS instead? How exactly are you using the mouseover? over just a link? over a TD?