suchen

Heim  >  Fragen und Antworten  >  Hauptteil

javascript - insertBefore到底有什么问题,没反应??

结果不是期望的反应??

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

<code><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>

</code>

PHPzPHPz2909 Tage vor362

Antworte allen(1)Ich werde antworten

  • ringa_lee

    ringa_lee2017-04-10 16:57:15

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

    1

    2

    <code>pp=document.getElementsByTagName('p');

    qq=document.getElementsByTagName('h1');</code>

    Antwort
    0
  • StornierenAntwort