<html>
<head>
<title>動態添加Script</title>
<script>
o=document.createElement("script"); //先創建script元素o
o.text="alert('test!')"; //script o 的動作是alert('test')
document.documentElement.childNodes[0].appendChild(o); //加入到頁面中顯示
</script>
</head>
<body>
</body>
</html>

arrow
arrow
    文章標籤
    javascript createElemen
    全站熱搜

    痞客興 發表在 痞客邦 留言(0) 人氣()