javascript void函数 [英] javascript void functions

查看:168
本文介绍了javascript void函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

我想问一下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,,,,thankx Note : same thing im typing 4 times to meet standards of stackoverflow...

推荐答案

void()

void():


此运算符允许插入表达式产生副作用
到表达式为undefined的表达式为

This operator allows inserting expressions that produce side effects into places where an expression that evaluates to undefined is desired.

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.

您可以在这个类似的主题上阅读更多内容:什么是javascript :无效(0)"是吗?

You can read more on this similar thread: What does "javascript:void(0)" mean?

这篇关于javascript void函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆