<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<body>
<p>PPP1</p>
<p>PPP2</p>
<p>PPP3</p>
<p>PPP4</p>
<p>PPP5</p>
<p>PPP6</p>
<p>PPP7</p>
<script>
var p=document.getElementsByTagName("P")
document.write(p[0].innerHTML)
for(i=0;i<p.length;i++)
{
document.write(p[i].innerHTML+"<br>")
}
</script>
</body>
</html>
如果把document.write(p[i].innerHTML+"<br>")修改成document.write(p[i].innerHTML+"<p>")就会无限循环,请问这是什么道理啊,但是br就完全没有问题啊。求解
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<body>
<p>PPP1</p>
<p>PPP2</p>
<p>PPP3</p>
<p>PPP4</p>
<p>PPP5</p>
<p>PPP6</p>
<p>PPP7</p>
<script>
var p=document.getElementsByTagName("P")
document.write(p[0].innerHTML)
for(i=0;i<p.length;i++)
{
document.write(p[i].innerHTML+"<br>")
}
</script>
</body>
</html>
如果把document.write(p[i].innerHTML+"<br>")修改成document.write(p[i].innerHTML+"<p>")就会无限循环,请问这是什么道理啊,但是br就完全没有问题啊。求解