新闻详情

添加动态的JS脚本

2938 2009/5/16
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>标题页</title>
<script>
    o=document.createElement("script");         //动态创建script元素
    o.text="alert('test!')";                    //输出语句。。是脚本中的代码
    document.documentElement.childNodes[0].appendChild(o);//将脚本添加到页面中
</script>
</head>
<body>
</body>
</html>

相关资讯

18973218026
返回顶部