Firefox 上的 Javascript 在 onchange 任务上意外停止执行
Javascript on Firefox stops execution unexpectedly on an onchange assignment
以下javascript代码片段在Google Chrome上运行良好,但在Firefox上的第二个警报之前不会继续:
init.js
:
function __init__() {
alert("welcome!");
document.getElementById("myselector").onchange = foo;
alert("must go here");
// some other initialization code goes here
alert("must end here");
}
window.onload = __init__;
foo.js
:
function foo() {
// some other code for function foo
break;
// the rest of the code
}
但是,Firefox或Chrome的开发人员工具控制台没有报告任何错误,这让我感到沮丧了好几天。
删除任何不在循环或switch
语句中使用break
语句。
相关文章:
- 无法在通过jQuery的ajax加载的页面中执行javascript
- JavaScript执行暂时挂起页面
- 如何在ReactJS JSX中执行嵌套的if-else语句
- 当js函数's已执行
- 哪个先执行
- 在使用Polymer'加载所有json文件后执行方法;s的核心ajax
- HTML表单提交时未执行外部函数
- 使用webcomponenetsjs的HTMLImports以意外的执行顺序加载导入-firefox
- 在文件中执行 IIFE 时出现意外输出.js
- jQuery无法正确完成提交,并在提交时执行意外操作
- Firefox 上的 Javascript 在 onchange 任务上意外停止执行
- 我得到了一个“;意外的令牌“;尝试对简单对象执行JSON.parse时出错
- animate方法函数执行意外延迟
- 角度意外行为.自执行函数调用作用域函数
- 执行Regex时的意外行为.在Regex.test之后执行
- jQuery滑块执行意外
- 未捕获的SyntaxError:在执行JSON.Parse时输入的意外结束
- asp.net ajax-javascript中出现意外的执行顺序
- jasmineNodeOpts:执行量角器时出现意外的标识符错误.js
- 当尝试执行JavaScript文件时,给了我一个:语法错误:意外的令牌)