简体   繁体   中英

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

There are three lines with console.log in my code here:

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>

In Firefox why do the second and third console.log logger not trigger unless I uncomment the first console.log ? This works fine in Chrome.

seem like firebug console is no longer support or update for latest firefox browser.

firefox have it own developer tool coming out no long ago, have all the features firebug have.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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