473,320 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 1256
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

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

Similar topics

1
by: Dominic | last post by:
Just in case someone is interested. I came up with this solution since my previous posting. Maybe you've got some other ideas or critcism. I'll listen ;-) Ciao, Dominic P.S. Python is...
2
by: George Hester | last post by:
In my neck of the woods functions usually have arguments. For example f(r) = 3 + r is a nice function. f(5) = 8, f(-3) = 0. In JavaScript we could write it like this: function f(r){ return (r...
2
by: Mitch | last post by:
I am hosting a web browser ctl in a container that implements the IDocHostUIHandler interface. I'm using this to control the context menu.This works fine. Then, I added a mouseover event to the...
1
by: Simon Harris | last post by:
Hi All, I'm new to asp.net (Migrating from 'Classic' ASP) I'm having troubles working out classes, functions etc... Current situation is this: index.aspx displays datalist with links to...
10
by: Emre Sevinc | last post by:
Take a look at the following snippet: <html> <head> <script> function add(elementId) { var container = document.getElementById(elementId); for (var i = 0; i < 10; i++) { var elt =...
5
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, i was wondering if the following code snippet from a 1.1 exerpt still apply in asp.net 2.0 framework: #region Web Form Designer generated code override protected void OnInit(EventArgs...
7
by: pronerd | last post by:
Does any one know how to add a function to an event handler with out losing the current event handler? For example you can add multiple functions to a single event handler with something like : ...
2
by: Ahmed | last post by:
Ok i understand the fact that once events are raised they are executed on another thread and have no access to member functions or variables because they are static functions. But i am having...
7
by: Christopher Pisz | last post by:
My problem is my derived class is getting called twice instead of the base and then the derived. I thought this was the purpose for virtuals and dynamic casting :/ I want my base class to have its...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.