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

Discussion in 'Javascript' started by foldface@yahoo.co.uk, Sep 25, 2005.

  1. Guest

    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
     
    , Sep 25, 2005
    #1
    1. Advertising

  2. Guest

    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.
     
    , Sep 25, 2005
    #2
    1. Advertising

  3. Guest

    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
     
    , Sep 26, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    443
    Howard
    May 18, 2005
  2. Mr. Ken
    Replies:
    3
    Views:
    522
  3. Bob
    Replies:
    5
    Views:
    264
  4. Dr. Leff
    Replies:
    7
    Views:
    223
  5. Replies:
    2
    Views:
    472
    Thomas 'PointedEars' Lahn
    Mar 11, 2008
Loading...

Share This Page