Disabling onclick (using Spry)

S

Steve

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?
 
L

-Lost

Steve said:
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
 
R

Randy Webb

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"
 
L

-Lost

Randy Webb said:
Steve said the following on 12/21/2006 4:03 PM:

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
 
R

Randy Webb

-Lost said the following on 12/21/2006 6:51 PM:
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
 
L

-Lost

Randy Webb said:
-Lost said the following on 12/21/2006 6:51 PM:

I did both :)


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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top