<div class="codetitle"> <span><a style="CURSOR: pointer" data="94890" class="copybut" id="copybut94890" onclick="doCopy('code94890')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code94890"> <br><script type="text/javascript"> <BR>//用于在friefox中调试 用console.log("hello"); <BR>/** function test(name) { <BR>console.log(name); <BR>} <BR>test("hello world");**/ <br><br>//调试的技巧 <BR>function showLog(message) { <BR>console.log(message); <BR>console.info(message); <BR>console.warn(message); <BR>console.error(message); <BR>console.debug(message); <BR>} <BR>function test(name) { <BR>showLog(name); <BR>} <BR>test("hello"); <br><br></script> <br> </div> <br>调试示例 <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="86605" class="copybut" id="copybut86605" onclick="doCopy('code86605')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code86605"> <br> <br> <br> <br><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <br><title>Insert title here</title> <br><script type="text/javascript"> <br><br>function method() { <BR>var result = 0; <BR>for(var i = 0; i < 10; i++) { <BR>result +=i; <BR>} <BR>document.getElementById("id1").innerHTML = result; <BR>} <br><br><BR></script> <br> <br> <br><input type="button" value="click" onclick="method()"> <br><div id="id1"></div> <br> <br> <br> </div>