js获取head标签

发布时间:2017年12月19日 作者:未知 查看次数:1127


document.getElementsByTagName("head")[0];



例:

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>删除head标签</title>

</head>

<body style="background-color: Black;">


<textarea id="ShowID" rows="30" cols="200"></textarea>


    <script type="text/javascript" language="javascript">

var tRm=document.getElementsByTagName("head")[0];

var ttt=document.documentElement;

ttt.removeChild(tRm);

var sTxt=document.getElementById("ShowID");

sTxt.value=document.documentElement.outerHTML;

    </script>


</body>

</html



版权所有!www.sieye.cn
E.Mail:sieye@sohu.com QQ:66697110