Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > button.onclick = new Function("func2()") + button.onclick

Reply
Thread Tools

button.onclick = new Function("func2()") + button.onclick

 
 
foldface@yahoo.co.uk
Guest
Posts: n/a
 
      09-25-2005
Hi
Subject says it all, how can I do this?

Also, do things like string functions belong to any object?
i.e. are they perhaps part of the window object but are a special
case? I wondering whether its possible to display all of their
names by iterating around something in the browser (suspect
their not and you can't but its worth asking)

Ta
F

 
Reply With Quote
 
 
 
 
dylan.moreland@gmail.com
Guest
Posts: n/a
 
      09-25-2005
Are you trying to call your new function and also the old one? You
can't add functions together. Something like this would work:

window._oldonload = window.onload;
window.onload = function(e) { func2(); window._oldonload(); };

Really, you should be registering these event listeners with the
appropriate DOM functions.

 
Reply With Quote
 
 
 
 
foldface@yahoo.co.uk
Guest
Posts: n/a
 
      09-26-2005

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Are you trying to call your new function and also the old one? You
> can't add functions together. Something like this would work:
>
> window._oldonload = window.onload;
> window.onload = function(e) { func2(); window._oldonload(); };
>
> Really, you should be registering these event listeners with the
> appropriate DOM functions.


That works fine thanks

I'm trying to make development a little easier by finding ways around
some annoying javascript/visual studio problems.

(1) .js files are locked by VS while your working on them and
sometimes the breakpoints won't work, even if you set them in the
running documents. I thought a way around this is would be
to add 'debugger' on the start of the appropriate event method via
some other javascript, hacky but it works.
Also I've written a DOM parser (yes, another one), so I can do this
(nearly) relatively easily, except I fell down on the syntax.

Other things include writing functions and then missing out brackets
and having to find them manually, jslint seems to help with this,
I'm not aware of any better ways

Thanks for the reply

F

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript new-new-new-new-newbee weblinkunlimited@gmail.com Javascript 2 03-11-2008 01:15 AM
New computer, New OS, New Wireless Problem :-\ =?Utf-8?B?RGFu?= Wireless Networking 3 07-31-2005 02:11 PM
[Firefox] Use New Tab instead of New Window? paul j Firefox 7 04-07-2005 09:40 PM
Why can not register a new .net passport or a new hotmail account Alick Lv MCSD 1 01-04-2004 06:12 PM



Advertisments