Disabling onclick (using Spry)

Discussion in 'Javascript' started by Steve, Dec 21, 2006.

  1. Steve

    Steve Guest

    I want to disable the onclick for a <div>. In onclick I am using
    Spry.Effect.AppearFade(...). Any suggestions on how to disable onclick
    after the first initial click from the user?
     
    Steve, Dec 21, 2006
    #1
    1. Advertising

  2. Steve

    -Lost Guest

    "Steve" <> wrote in message
    news:...
    >I want to disable the onclick for a <div>. In onclick I am using
    > Spry.Effect.AppearFade(...). Any suggestions on how to disable onclick
    > after the first initial click from the user?


    If you were somehow reloading the page you could use onclick="return false;". As this is
    a DHTML library I assume that is not the case.

    You could then use form fields with an event handler and disable them after their initial
    click.

    -Lost
     
    -Lost, Dec 21, 2006
    #2
    1. Advertising

  3. Steve

    Steve Guest

    SWEET! Thanks Randy, that did it!

    Randy Webb wrote:
    > Steve said the following on 12/21/2006 4:03 PM:
    > > I want to disable the onclick for a <div>. In onclick I am using
    > > Spry.Effect.AppearFade(...). Any suggestions on how to disable onclick
    > > after the first initial click from the user?
    > >

    >
    > onclick="someFunction();this.onclick = null"
    >
    > --
    > Randy
    > Chance Favors The Prepared Mind
    > comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
    > Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Steve, Dec 21, 2006
    #3
  4. Steve

    Randy Webb Guest

    Steve said the following on 12/21/2006 4:03 PM:
    > I want to disable the onclick for a <div>. In onclick I am using
    > Spry.Effect.AppearFade(...). Any suggestions on how to disable onclick
    > after the first initial click from the user?
    >


    onclick="someFunction();this.onclick = null"

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Dec 21, 2006
    #4
  5. Steve

    -Lost Guest

    "Randy Webb" <> wrote in message
    news:...
    > Steve said the following on 12/21/2006 4:03 PM:
    >> I want to disable the onclick for a <div>. In onclick I am using
    >> Spry.Effect.AppearFade(...). Any suggestions on how to disable onclick
    >> after the first initial click from the user?
    >>

    >
    > onclick="someFunction();this.onclick = null"


    Heh. Well, Steve said "disable" not "kill".

    Offhand, is there a way to revive the event handler (after nullifying it)?

    Thanks.

    -Lost
     
    -Lost, Dec 21, 2006
    #5
  6. Steve

    Randy Webb Guest

    -Lost said the following on 12/21/2006 6:51 PM:
    > "Randy Webb" <> wrote in message
    > news:...
    >> Steve said the following on 12/21/2006 4:03 PM:
    >>> I want to disable the onclick for a <div>. In onclick I am using
    >>> Spry.Effect.AppearFade(...). Any suggestions on how to disable onclick
    >>> after the first initial click from the user?
    >>>

    >> onclick="someFunction();this.onclick = null"

    >
    > Heh. Well, Steve said "disable" not "kill".


    I did both :)

    > Offhand, is there a way to revive the event handler (after nullifying it)?


    Store a reference to it and then set it back.

    onclick="someFunction();this.oldOnClick=this.onclick;this.onclick=null"

    And then some way to restore it:

    document.getElementById('thatElement').onclick=document.getElementById('thatElement').oldOnClick

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Dec 22, 2006
    #6
  7. Steve

    -Lost Guest

    "Randy Webb" <> wrote in message
    news:...
    > -Lost said the following on 12/21/2006 6:51 PM:
    >> "Randy Webb" <> wrote in message
    >> news:...
    >>> Steve said the following on 12/21/2006 4:03 PM:
    >>>> I want to disable the onclick for a <div>. In onclick I am using
    >>>> Spry.Effect.AppearFade(...). Any suggestions on how to disable onclick
    >>>> after the first initial click from the user?
    >>>>
    >>> onclick="someFunction();this.onclick = null"

    >>
    >> Heh. Well, Steve said "disable" not "kill".

    >
    > I did both :)
    >
    >> Offhand, is there a way to revive the event handler (after nullifying it)?

    >
    > Store a reference to it and then set it back.
    >
    > onclick="someFunction();this.oldOnClick=this.onclick;this.onclick=null"
    >
    > And then some way to restore it:
    >
    > document.getElementById('thatElement').onclick=document.getElementById('thatElement').oldOnClick


    Awesome. Thanks.

    Be well.

    -Lost
     
    -Lost, Dec 22, 2006
    #7
    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. Michael Groeger
    Replies:
    2
    Views:
    508
    Michael Groeger
    Jan 20, 2006
  2. pplschmp
    Replies:
    2
    Views:
    1,278
    Andrew Thompson
    Jun 29, 2008
  3. charlie imac

    load adobe spry gallery

    charlie imac, Jul 30, 2007, in forum: Javascript
    Replies:
    1
    Views:
    119
    charlie imac
    Jul 31, 2007
  4. Martin Nadoll

    new feature for spry gallery

    Martin Nadoll, Mar 28, 2008, in forum: Javascript
    Replies:
    0
    Views:
    101
    Martin Nadoll
    Mar 28, 2008
  5. Dan NITA
    Replies:
    0
    Views:
    104
    Dan NITA
    Oct 30, 2009
Loading...

Share This Page