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);

你可能感兴趣的:(java)