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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to reset style Class to an elementment onmouseover? 1

Status
Not open for further replies.

Ovatvvon

Programmer
Joined
Feb 1, 2001
Messages
1,514
Location
US
Hello All,

I recall changing the CSS class assigned to an element dynamically when the mouse scrolls over the element, but now am having problems trying to figure out how to do it again. I've tried several methods, but keep coming up without the correct solution.

Currently:
Code:
<span id="exampleElement" class="sampleClass" onMouseOver="document.getElementById('exampleElement').style='newClass';">Some sample text</span>

Can anyone help?


-Ovatvvon :-Q
 
Ah. I had tried the classname bit, but had used the syntax,

Code:
document.getElementById('exampleElement').style.className='newClass';

Thanks!

-Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top