為什麼下面代碼console.info無法打印
<!DOCTYPE html>
<html>
<head>
<title>HTML DOM DEMO</title>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<script>
function abc(){
console.info(88);//todo 為什麼不能打印
var demo = document.getElementById("demo1");
while (demo) {
document.write('<li>' + demo.nodeName + '</li>');
console.info(1);//todo 為什麼不能打印
demo = demo.previousElementSibling;
}
}
</script>
</head>
<body>
<input type="button" value="RUN" onclick="abc();">
<div id="demo1">There is no spoon.</div>
<div id="demo2">Believe the unbelievable.</div>
<div id="demo3">Free your mind.</div>
</body>
</html>
document.write會覆蓋當前文檔,改為alert或者document.body.innerHTML+=