[thelist] Events

Chris Marsh chris at webbtech.co.uk
Fri Nov 1 12:47:01 CST 2002

Sorry, wrong subject line. That will teach me to be lazy :)

> Dear all
> I have a number of elements on a page, each with an id. I
> want certain javascript functions to fire on certain events,
> but I don't want to specify event handlers in any tags nested
> within (but not including) the body. If I have a function
> Init() that fires on page load, is there some way I can do
> the following (the code is incorrect and for illustrative
> purposes only):
> function Init() {
>   var foo = document.getElementById("bar");
>   foo.onClick = alert("Eureka!");
> }
> Many thanks in advance...
> Regards
> Chris Marsh

More information about the thelist mailing list