Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Disabling onclick (using Spry)

Reply
Thread Tools

Disabling onclick (using Spry)

 
 
Steve
Guest
Posts: n/a
 
      12-21-2006
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?

 
Reply With Quote
 
 
 
 
-Lost
Guest
Posts: n/a
 
      12-21-2006
"Steve" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
>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


 
Reply With Quote
 
 
 
 
Steve
Guest
Posts: n/a
 
      12-21-2006
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/


 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      12-21-2006
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/
 
Reply With Quote
 
-Lost
Guest
Posts: n/a
 
      12-21-2006
"Randy Webb" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      12-22-2006
-Lost said the following on 12/21/2006 6:51 PM:
> "Randy Webb" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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.oncli ck;this.onclick=null"

And then some way to restore it:

document.getElementById('thatElement').onclick=doc ument.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/
 
Reply With Quote
 
-Lost
Guest
Posts: n/a
 
      12-22-2006
"Randy Webb" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> -Lost said the following on 12/21/2006 6:51 PM:
>> "Randy Webb" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> 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.oncli ck;this.onclick=null"
>
> And then some way to restore it:
>
> document.getElementById('thatElement').onclick=doc ument.getElementById('thatElement').oldOnClick


Awesome. Thanks.

Be well.

-Lost


 
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
Overriding an onclick with another onclick tomlong@gmail.com Javascript 4 01-26-2006 09:26 PM
Problem w/ disabling buttons after onclick on clientside Michael Groeger ASP .Net 2 01-20-2006 01:18 PM
void(0) is disabling my onclick event (ie only) ??? seth.m.green@gmail.com Javascript 20 12-22-2005 03:46 PM
button.onclick = new Function("func2()") + button.onclick foldface@yahoo.co.uk Javascript 2 09-26-2005 08:13 AM
document.onclick=doIt() same as document.onclick=doIt ? bob Javascript 3 08-21-2003 12:14 PM



Advertisments