日期:2014-05-16 浏览次数:20505 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
<meta http-equiv="description" content="this is my page" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script language="JavaScript">
var fkElement = document.getElementById("fk");
alert(fkElement.nodeType);
var fkparentElement = fkElement.parentNode();
alert(fkparentElement.nodeType);
fkparentElement.removeChild(fkElement);
</script>
</head>
<body>
我喜欢的游戏:<br/>
<ul>
<li id="fk" value="fankong">
反恐
</li>
<li id="ms" value="moshou">
魔兽
</li>
<li id="xj" value="xingji">
星际
</li>
</ul>
</body>
</html>
window.onload = function(){
var fkElement = document.getElementById("fk");
alert(fkElement.nodeType);
var fkparentElement = fkElement.parentNode;
alert(fkparentElement.nodeType);
fkparentElement.removeChild(fkElement);
}