Click to See Complete Forum and Search --> : Call two events on mouseover?


itKiwi
04-15-2007, 09:55 AM
I am using inline js to change the cursor.
onmouseover=style.cursor='pointer'
I also want the font to be bold on mouseover, ie.,
onmouseover=style.fontWeight='bold'
Separately, these both work, but how can I combine them ?
Thanks

Mr J
04-15-2007, 10:08 AM
Try something on these lines

<style type="text/css">

.default{
font-weight:normal;
}

.m_over{
cursor:pointer;
font-weight:bold;
}

</style>

<div class="default" onmouseover="this.className='m_over'" onmouseout="this.className='default'">Hello World</div>

itKiwi
04-15-2007, 03:30 PM
Thanks Mr J. An exercise in lateral thinking, though it wasn't quite that straightforward. I am using innerHTML, with a loop to convert an array into <div> strings, so I had to play with the syntax, which is something new I've learned today.
Thanks again.:)

Znupi
04-15-2007, 04:33 PM
1. To call two events on onMouseOver use this:
<div onMouseOver="function1(); function2();">...
2. You don't have to change the cursor CSS property upon mouse over. You can just specify it in your stylesheet.

div {
cursor: pointer;
}

:)

Logic Ali
04-15-2007, 07:36 PM
To call two events on onMouseOverTo call two functions in an event handler.