问答详情
源自:9-13 插入节点insertBefore()

请问我的哪里不对?

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>无标题文档</title>

</head>

<body>


<ul id="test">

<li >JavaScript</li>

<li id="x1">HTML</li>

    

</ul> 

 

<script type="text/javascript">


  var otest = document.getElementById("test"); 

  var node = document.getElementById("x1");

  var newnode = document.createElement("li");

  newnode.innerHTML="php";

  otese.insertBefore(newnode,node);


  

  

  

</script> 


</body>

</html>


提问者:慕粉15680718726 2016-07-29 23:35

个回答

  • hadu
    2016-07-30 00:27:22
    已采纳

     otese.insertBefore(newnode,node);      是不是此处单词写错otest