Hi abb
Read the articles suggested by Kravvitz. I wonder if he spend all day searching for good links to the rest of us :-)
You could do it this way separating content and behavior:
HTML Code:
<div id="foo1">Block</div>
and put this in a js file that is loaded AFTER the HTML on your page:
Code:
var divFoo1 = document.getElementById("foo1");
divFoo1.onmouseover = function() {...the code that should run when mouse over...};
and a more modern way (DOM2):
Code:
document.getElementById("foo1").addEventListener("mouseover", name_of_function_to_run, true);
But beware: Old browsers may not understand the DOM2 way.
You could make a shortcut and use a javascript library instead of create all, lets call it usual, code yourself. I use http://www.cross-browser.com. I started using it after I realised I would be 90 before I had written all the functions I need...
Or search the web for other libraries.
Michael
Bookmarks