<body>
<ul id="test"><li>JavaScript</li><li>HTML</li></ul>
<script type="text/javascript">
var otest = document.getElementById("test");
var node = document.getElementsByTagName("li")[1];
var newnode = document.createElement("li");
newcode.innerHTML ="PHP";
otset.insertBefore(newnode,node);
</script>
</body>
把你的newcode改成newnode