<!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>HTML</li></ul>
<script type="text/javascript">
var otest = document.getElementById("test");
var _bab = otest.fisrtChild;
var _didi = document.createElement("li");
_didi.innerHTML = "php";
otest.insertBefore(_didi,_bab);
</script>
</body>
</html>
是你拼错了,是first,不是fisrt
可能是因为你这一行的 first拼错了 改一下试试:var _bab = otest.firstChild;