T
Tuxedo
Is it possible to add a function call to the onUnload event handler from an
external js file, or can this only be done via the body tag?
In any case, I presume there can only exist one onUnload event handler,
which can naturally include any number of function calls.
I have instances of html pages, with an existing onUnload event handlers
and those without.
I'd like to cover both instances, if possible, so that if there is an
onUnload call already defined in the body tag, to attach or add a function
to that existing event handler, while if there is none, create the onUnload
event handler via a js file, along with some function it should launch.
In other words, if 'page1.html' already contains ..
<body onUnload="some_function()">
... while if 'page2.html' contains only <body> without an onUnload call, and
if both pages shares a one and same external 'include.js' file with
some_other_function(); to be called onUnload, can: 1) the result for
page1.html be made to do the same as if the following was hardcoded in the
body tag:
<body onUnload="some_function();some_other_function();">
But in case of page2.html, the result would be the same as if this alone
was in the body tag:
<body onUnload="some_other_function();">
I guess this would be a kind of dymanic event handler and function
depending on whether or not the onOnload handler exists in the body tag
already before. Is this at all possible?
Thanks,
Tuxedo
external js file, or can this only be done via the body tag?
In any case, I presume there can only exist one onUnload event handler,
which can naturally include any number of function calls.
I have instances of html pages, with an existing onUnload event handlers
and those without.
I'd like to cover both instances, if possible, so that if there is an
onUnload call already defined in the body tag, to attach or add a function
to that existing event handler, while if there is none, create the onUnload
event handler via a js file, along with some function it should launch.
In other words, if 'page1.html' already contains ..
<body onUnload="some_function()">
... while if 'page2.html' contains only <body> without an onUnload call, and
if both pages shares a one and same external 'include.js' file with
some_other_function(); to be called onUnload, can: 1) the result for
page1.html be made to do the same as if the following was hardcoded in the
body tag:
<body onUnload="some_function();some_other_function();">
But in case of page2.html, the result would be the same as if this alone
was in the body tag:
<body onUnload="some_other_function();">
I guess this would be a kind of dymanic event handler and function
depending on whether or not the onOnload handler exists in the body tag
already before. Is this at all possible?
Thanks,
Tuxedo