javascript - insertBefore到底有什么问题,没反应??
PHPz
PHPz 2017-04-10 16:55:15
0
1
363

结果不是期望的反应??

<html>
<head>
<meta charset="utf-8">
<script src="text.js"></script>
</head>
<body>
<p>111</p>
<h1>hjg</h1>
<script >
pp=document.getElementsByTagName(p);
qq=document.getElementsByTagName(h1);
pp[0].parentNode.insertBefore(qq[0],pp[0]);
</script>
</body>
</html>
PHPz
PHPz

学习是最好的投资!

reply all(1)
左手右手慢动作

字符串是要用引号包裹的:

pp=document.getElementsByTagName('p');
qq=document.getElementsByTagName('h1');
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template