<!DOCTYPE html>
<html lang="en">
<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>
I found
window.onload = function(){
var mybox = document.getElementsByTagName("li");
document.write("<xmp>"+mybox[0].innerHTML+"</xmp>");
alert(mybox[0].innerHTML);
console.log(mybox[0].innerHTML);
}
Three sentences in :
document.write("<xmp>"+mybox[0].innerHTML+"</xmp>");
alert(mybox[0].innerHTML);
console.log(mybox[0].innerHTML);
only one sentence can be executed
document.write ("< xmp >"+ mybox [0] .innerHTML +"< / xmp >");
Why are the last two sentences of < xmp > not executed after the execution of document.write ("< xmp >"+ mybox [0] .innerHTML +"< / xmp >")?
alert(mybox[0].innerHTML);
console.log(mybox[0].innerHTML);