createElement和appendChild创建元素
2010-06-19 11:31 yuejianjun 阅读(250) 评论(0) 编辑 收藏 举报<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type ="text/javascript" >
function getE()
{
tempA=document.createElement('a');
tempA.href="#";
tempA.innerHTML="#";
tempA.setAttribute("title","fasdf");
document.body.appendChild(tempA);
ds = document.createElement("input");
ds.type = "text";
ds.value = "vvvv";
document.body.appendChild(ds);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type ="button" value ="onclick" onclick ="getE()" />
</div>
</form>
</body>
</html>