首页 > 其他 > 详细

createTextNode() 方法和createTextNode()方法

时间:2017-07-31 15:39:36      阅读:396      评论:0      收藏:0      [点我收藏+]

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<p id="demo">单击按钮创建一个标题</p>
<button onclick="myFunction()">点我</button>
<script>
function myFunction(){
var h=document.createElement("H1");
var t=document.createTextNode("Hello World");
h.appendChild(t);
document.body.appendChild(h);
};

</script>

</body>
</html>

 

 

document.createElement()    创建元素节点

document.createAttribute()   创建一个属性节点

document.createTextNode() 创建文本节点

 

createTextNode() 方法和createTextNode()方法

原文:http://www.cnblogs.com/hulaoxi/p/7263040.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!