通过createElement(),createTextNode),appendChild()方法来显示文字

来源:互联网 发布:印度英语的特点知乎 编辑:程序博客网 时间:2024/06/08 17:08
通过createElement(),createTextNode),appendChild()方法来显示文字 - lishirong - The CTO of LiShirong
 
<!--通过createElement(),createTextNode),appendChild()方法来显示文字-->
<html>
<head>
<title>createElement() Example</title>
<script type="text/javascript" language="javascript">
function createMessage(){
var oP=document.createElement("p");
var oText=document.createTextNode("Hello World!");
oP.appendChild(oText);
document.body.appendChild(oP);
}
</script>
</head>
<body bgcolor="#CCFFFF" onload="createMessage()">
</body>
</html>
0 0
原创粉丝点击