step是google chrome保留变量

  今天测试js代码时,无意中中发现google chrome浏览器的onclick执行自定义的step函数时,尽然发现无法执行,出现Uncaught TypeError: string is not a function错误。搞幽。step尽然是google chrome浏览器的保留变量。

  测试代码如下
+展开
-HTML
<script type="text/javascript">
function step(){alert('自定义函数!');}
</script> 
<input type="button" value="输出类型" onclick="alert(typeof step)"/><!--输出string--><br>
<input type="button" value="执行step函数" onclick="step()"/><!--发生错误,控制台输出Uncaught TypeError: string is not a function错误-->


Uncaught Type Error string is not a function

加支付宝好友偷能量挖...


原创文章,转载请注明出处:step是google chrome保留变量

评论(0)Web开发网
阅读(121)喜欢(0)JavaScript/Ajax开发技巧