我的代码:
<div id="box">
<p>
123
</p>
<p>
abc
</p>
</div>
<script>
var html = document.getElementById("box").innerHTML;
for (var i = 0, len = html.length; i < len; i++) {
var word = html.charAt(i)
alert("_" + word + "_" + i) //Attention!! when the "i" == 0
if (i == 0) {
alert(word==" ") // it is false.....
}
}
</script>
使用 API : "chatAt" , 怎么写 我可以知道 HTML 的代码正在换行.....(word == what????)