简体   繁体   English

Firefox / Firebug JavaScript console.log在某些情况下无法在for循环中使用

[英]Firefox/Firebug JavaScript console.log not working in for loop in certain scenarios

There are three lines with console.log in my code here: 在我的代码中, console.log有三行内容:

JavaScript 的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 的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>

In Firefox why do the second and third console.log logger not trigger unless I uncomment the first console.log ? Firefox中,除非取消对第一个console.log注释,为什么第二个和第三个console.log记录器不会触发? This works fine in Chrome. 在Chrome中可以正常使用。

seem like firebug console is no longer support or update for latest firefox browser. 似乎Firebug控制台不再支持或更新最新的firefox浏览器。

firefox have it own developer tool coming out no long ago, have all the features firebug have. firefox不久前推出了自己的开发人员工具,具有firebug的所有功能。

http://etenbo.com/why-firebug-for-firefox-javascript-console-log-is-not-working/ http://etenbo.com/why-firebug-for-firefox-javascript-console-log-is-not-working/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM