<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
window.onload = function(){
var mybox = document.getElementsByTagName("li");
document.write('<xmp>'+mybox[0].innerHTML+'</xmp>');
alert(mybox[0].innerHTML);
console.log(mybox[0].innerHTML);
}
</script>
</head>
<body>
<ul id="box">
<li><img src="image/i1.png" alt=""></li>
<li><img src="image/i2.png" alt=""></li>
<li><img src="image/i3.png" alt=""></li>
</ul>
</body>
</html>
我发现
window.onload = function(){
var mybox = document.getElementsByTagName("li");
document.write('<xmp>'+mybox[0].innerHTML+'</xmp>');
alert(mybox[0].innerHTML);
console.log(mybox[0].innerHTML);
}
里面的三句话:
document.write('<xmp>'+mybox[0].innerHTML+'</xmp>');
alert(mybox[0].innerHTML);
console.log(mybox[0].innerHTML);
只有一句可以执行
document.write('<xmp>'+mybox[0].innerHTML+'</xmp>');
为何执行完 document.write('<xmp>'+mybox[0].innerHTML+'</xmp>');
后面的两句不执行了?
alert(mybox[0].innerHTML);
console.log(mybox[0].innerHTML);
暮色呼如
守候你守候我
MYYA
相关分类