Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
92
rated 0 times [  98] [ 6]  / answers: 1 / hits: 24207  / 14 Years ago, wed, may 19, 2010, 12:00:00

can someone please help me with this javascript:void(null)
I found it used in link buttons as follows



<a onclick=ProcessResponse() href=javascript:void(null) >Accept Data</a>

More From » javascript

 Answers
46

Basically what happens is the onclick the function ProcessResponse() is called and the href is set to javascript:void(null) to disable the default behaviour of the link.



Most developers are simply used to writing this too:



<a onclick=ProcessResponse(); return false; href=# >Accept Data</a>


Example:



Suppose we have this link in place:



<a onclick=ProcessResponse(); return false; href=http://www.google.com >Accept Data</a>


Note that href is set to www.google.com but when you actually click on that link, it would simply call the ProcessResponse() function and won't go to www.google.com because the return false put after ProcessResponse() disables the default behavior of the link that is going to www.google.com. Same is the case for the link you have posted.


[#96741] Monday, May 17, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
minab

Total Points: 701
Total Questions: 104
Total Answers: 91

Location: Saint Pierre and Miquelon
Member since Fri, Jan 28, 2022
2 Years ago
;