Firefox/Firebug JavaScript 控制台.log在某些情况下无法在 for 循环中工作
Firefox/Firebug JavaScript console.log not working in for loop in certain scenarios
我的
代码中有三行带有console.log
:
JavaScript
window.onload = function()
{//console.log('window.onload');
var tr = document.getElementsByTagName('table').0].getElementsByTagName('tr');
for (var i = 0; i < tr.length; i++)
{
console.log('i,1 = '+i);
(function(i)
{
console.log('i,2 = '+i);
if (tr[i].getElementsByTagName('input').length>1)
{
tr[i].getElementsByTagName('input')[1].addEventListener('click', function(event) {sessionStorage.hash_self_tr = i;}, false);}})(i);
}
}
.HTML
<table>
<tr><td>1<input type="checkbox" /></td></tr>
<tr><td>2<input type="checkbox" /></td></tr>
<tr><td>3<input type="checkbox" /></td></tr>
</table>
在Firefox中,为什么除非我取消注释第一个console.log
,否则第二个和第三个console.log
记录器不会触发?这在Chrome中工作正常。
似乎
Firebug控制台不再支持或更新最新的Firefox浏览器。
Firefox 不久前就推出了自己的开发工具,具有 Firebug 的所有功能。
http://etenbo.com/why-firebug-for-firefox-javascript-console-log-is-not-working/
相关文章:
- 为什么JavaScript在for循环为3时向所有4发出警报
- 另一个ajax调用中的Jquery ajax调用在for循环中没有按预期工作
- 我的javascript for循环不起作用
- For循环冻结Javascript
- 如何在for循环中添加事件侦听器
- 双“for”循环(循环)
- javascript for循环不起作用
- for循环中的javascript if语句找不到==
- Javascript在for循环中等待处理请求
- For循环在Jquery中只运行一次
- 如何在for循环中使用计数器
- for循环中的JavaScript闭包
- 为什么我们在ES2015中需要一个新的for循环结构,而我们已经有了for、forEach
- For循环在调用时未运行
- 如何使用for循环添加所有按钮'单击事件
- 如何更改在for循环中生成的圆的位置
- 为什么这个For循环会使浏览器实验室崩溃
- 为什么我使用javascript获得了一个无限的for循环
- 在for循环中使用多维数组设置google.maps.Marker图标
- 如何在angularJS中运行for循环而不使用html标记