Possible Duplicate:
What does “javascript:void(0)” mean?
我想问几个关于 javascript:void(0)
的问题
<input type='submit' name='btn' value='submit' onClick='javascript:void(0)' />
你能解释一下 void(0)
- 它是内置函数吗?关键字javascript
是否代表代码是用javascript写的?如果您对此有什么奇怪的了解,请与我分享。谢谢。
void() :
This operator allows inserting expressions that produce side effects
into places where an expression that evaluates to undefined is
desired.
The void operator is often used merely to obtain the undefined
primitive value, usually using "void(0)" (which is equivalent to "void
0"). In these cases, the global variable undefined can be used instead
(assuming it has not been assigned to a non-default value).
Note, however, that the javascript: pseudo protocol is discouraged over other alternatives, such as unobtrusive event handlers.
您可以在这个类似的主题上阅读更多内容:What does "javascript:void(0)" mean?