Main Points
- Unobtrusive Javascript Example 2 Change the display property of a div.
- Skip to Main Points links return to the Main Points menu.
Unobtrusive Javascript Example 2
This page calls a Javascript file. The onmouseover events which the div in red responds to is in the Javascript file, not this html document. This formulation didn't work when I was experimenting with what I thought was the simpler background-color. I think it did NOT like the hyphen. Anyway, even though I thought throwing in the second div would be more problematic, it worked beautifully first time. If I'm not careful, I'm going to get cocky.
...Except of course, I still have no idea how to change background color with Javascript. That should keep me humble for at least a little while.
This example uses the same basic Javascript as the last example. It waits for a mouseover event on the red div. It then triggers a test alert box to fire and reveals the blue div (by changing its display from none to block).