![](/img/trans.png)
[英]Firebug's console.log prints unexpected value using javaScript
[英]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/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.