问题描述
我想问一下javascript:void(0)
i want to ask about javascript:void(0)
<input type='submit' name='btn' value='submit' onClick='javascript:void(0)' />
<input type='submit' name='btn' value='submit' onClick='javascript:void(0)' />
<input type='submit' name='btn' value='submit' onClick='javascript:void(0)' />
<input type='submit' name='btn' value='submit' onClick='javascript:void(0)' />
你能解释一下void(0),它是内置函数吗?
是关键字'javascript'告诉代码是javascript语言?
任何奇怪的东西,如果你知道它请与我分享,,,, thankx
注意:同样的事情我输入4次符合stackoverflow的标准...
can you please explain about void(0), is it builtin function ?is keyword 'javascript' telling that code is of javascript language?anything wierd if you know about it please share with me,,,,thankxNote : same thing im typing 4 times to meet standards of stackoverflow...
推荐答案
:
void():
void运算符通常仅用于获取未定义的
原始值,通常使用void(0)(相当于void
0)。在这些情况下,可以使用全局变量undefined来代替
(假设它尚未分配给非默认值)。
但请注意,不建议使用javascript:pseudo协议,例如不显眼的事件处理程序。
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.
您可以在这个类似的主题上阅读更多内容:
You can read more on this similar thread: What does "javascript:void(0)" mean?
这篇关于javascript void函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!