Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

Reset back the handled event

Hi,

 i  have a code like this,

document.onclick = temp;

In temp() function , i am suppressing the click event of a link.

In a particular scenario, i am forced to do this. And after certain conditions, i need to reset the on click event of the link back to its normal state.

 How to reset this "document.onclick"?

Could anyone pls help me out in this?

Thanks
0
ramsharma23
Asked:
ramsharma23
1 Solution
 
BatalfCommented:
If you want to clear the onclick event, you can do it like this:

document.onclick=''

example:

<body>
<script>
function alertIt(){
  alert('Clicked');
}
document.onclick=alertIt;
</script>

<a href="#" onclick="document.onclick='';return false">Reset</a>

</body>
</html>
0
 
ZvonkoSystems architectCommented:
Reseting the onClick handler is done by assigning null:

document.onclick = null;
0
 
ZvonkoSystems architectCommented:
It seams Batalf's empty String is equivalent to null assignment. At least it gives no error neither in IE6.0 nor in FF1.0

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
ramsharma23Author Commented:
Thanks a lot
0
 
BatalfCommented:
ramsharma23,

are you ready to close this question?

Batalf
0
 
BatalfCommented:
ramsharma23,

you have 23 opened questions. Maybe it's time to close some of them:-)

Batalf
0
 
Cem TürkSenior Software EngineerCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: Batalf

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

cem_turk
EE Cleanup Volunteer
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now