您的位置:首页 > 移动开发

createElement和appendChild创建元素

2010-06-19 11:31 162 查看
<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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: