[thelist] Appending actions to event handlers in Javascript

Tom Dell'Aringa pixelmech at yahoo.com
Tue Oct 21 19:23:49 CDT 2003


--- Roger Ly <evolt at matchpenalty.com> wrote:

> I'm having a problem trying to assign an onload handler to a couple
> of pages.  Both pages have a Javascript include, which contains the
> following:
> 
> window.onload = doSomething;
> 
> function doSomething()
> {
> 	//blah
> }

> On one page, I just have a plain <body> tag, and when the page is
> loaded, it correctly fires off the doSomething() function.
> 
> On the other page, I have a <body> tag with its on onload handler:
> <body onload="doThis();">

Hope I'm not oversimplying this or missed the problem but to me you
have two options.

1:

window.onload = doStuff;

function doStuff()
{
   doSomething();
   doThis();
}

or

body onload="doSomething(); doThis();"

Unless there is some reason they can't be together?

HTH

Tom

=====
http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: JavaScript Author / Every Friday!
http://www.thywordistruth.net/ :: Eternal Life

"The fun you can have with a bunch of old rocks and a can of yellow paint." (Bonzana Bunny, 1959)


More information about the thelist mailing list