当前位置: 代码迷 >> Web前端 >> appendChild()跟insertBefore
  详细解决方案

appendChild()跟insertBefore

热度:512   发布时间:2012-10-26 10:30:59.0
appendChild()和insertBefore
	var area = document.getElementById("newArea");
			var newNode = document.createElement("input");
			newNode.type = "button";
			newNode.value = "这是测试加载的小例子";
			//newNode.setAttribute("type", "button");
			//newNode.setAttribute("value", "这是测试加载的小例子");
			newNode.onclick = function test(){
				alert("click");
			}
			var o = area.appendChild(newNode);