This is my JavaScript’s onMouseOver event handler for Div tags. (It works fine, in at least Chrome and IE):
function changeCallout(sender, e) {
document.getElementById(sender.id).className = "callout2";
}
What I would like to be able to do is to set the color property of the H2 tag contained within the Div that is having it’s class changed.
I know I should be able to access either the color property or change the class, but I’m not able to figure out how to access only the appropriate H2 tag (I’m aware of getElementsByTagName). What’s the syntax to do this?
Assuming the wanted
h2is the first one under the targetdiv, then use the following to search relative to thatdiv:If it’s not the first one, simply change
0ton(on the second line) wherenis the position of the desired header.