javascript 无效函数

标签 javascript

<分区>

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?

关于javascript 无效函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13037126/

相关文章:

c# - IE 和 Mozilla Firefox 之间的 JavaScript 行为差异?

javascript - 如何调试我网站上的 Facebook JavaScript api 错误?

Javascript 从字符串中提取数字

javascript - 我的 React 应用程序将我的图像的 URL 呈现为 url ('undefined' );

javascript - js.writeFile 未正确写入 Blob

javascript - Gulp 插件根据运行的任务包含/排除 JS 代码行

asp.net - 禁止使用 jquery 在所有输入文本框中输入少量字符,例如 .'<' 、 '>'

javascript - 在所有数组元素之间添加 'commas' 分隔符,在最后一个数组元素之前添加 'and'

javascript - Node中如何返回HTTP错误状态码?

php - 如何访问 require.js 异步加载的 Javascript 中的 URL 参数?