469,934 Members | 1,857 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

How do I apply two functions to the same event handler?

1
Currently I have onBeforeUnload with a certain function being activated within my page. On one of my pages I need to apply another function onto onBeforeUnload, so that both functions will upload. I've been using:

Expand|Select|Wrap|Line Numbers
  1. var objBody = document.body;
  2. var oldEventHandler = objBody.onBeforeUnload
  3. objBody.onBeforeUnload = function() { oldEventHandler(); test(); }
  4. //test is a function elsewhere.
  5.  
The main problem I am facing is I can't seem to be able to get to the body's true onBeforeUnload. When i bring up the body within Visual Studio and I look at the array I cannot find my previous function applied to onBeforeUnload anywhere.

Any suggestions?

Thank you,

Holy
Dec 11 '07 #1
2 1109
function beforebefore()
{
func1();
fun2();
}

objBody.onBeforeUnload = beforebefore();


Currently I have onBeforeUnload with a certain function being activated within my page. On one of my pages I need to apply another function onto onBeforeUnload, so that both functions will upload. I've been using:

Expand|Select|Wrap|Line Numbers
  1. var objBody = document.body;
  2. var oldEventHandler = objBody.onBeforeUnload
  3. objBody.onBeforeUnload = function() { oldEventHandler(); test(); }
  4. //test is a function elsewhere.
  5.  
The main problem I am facing is I can't seem to be able to get to the body's true onBeforeUnload. When i bring up the body within Visual Studio and I look at the array I cannot find my previous function applied to onBeforeUnload anywhere.

Any suggestions?

Thank you,

Holy
Dec 11 '07 #2
acoder
16,027 Expert Mod 8TB
Currently I have onBeforeUnload with a certain function being activated within my page. On one of my pages I need to apply another function onto onBeforeUnload, so that both functions will upload.
Use addEventListener/attachEvent - see link.
Dec 12 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by George Hester | last post: by
1 post views Thread by Simon Harris | last post: by
5 posts views Thread by =?Utf-8?B?cm9kY2hhcg==?= | last post: by
7 posts views Thread by Christopher Pisz | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.