Add the text input box content to the js code in the table_javascript skills
Release: 2016-05-16 17:25:25
Original
1202 people have browsed it
表格处理.html
姓名 |
邮箱 |
地址 |
jzy |
359@qq.com |
重庆 |
jzy |
359@qq.com |
重庆 |
<script> <br>document.getElementById("submit").onclick=function(){ <br>//alert("success"); <br>//获取输入节点 <br>var nameElement=document.getElementById("iname"); <br>var emailElement=document.getElementById("iemail"); <br>var addresssElement=document.getElementById("iaddress"); <br><br>//创建表格节点 <br>var trNode=document.createElement("tr"); <br>var nameNode=document.createElement("td"); <br>var emailNode=document.createElement("td"); <br>var addressNode=document.createElement("td"); <br><br>//向表格中添加创建的节点及文本内容 <br>var borderElement=document.getElementById("border"); <br>borderElement.appendChild(trNode); <br>trNode.appendChild(nameNode); <br>trNode.appendChild(emailNode); <br>trNode.appendChild(addressNode); <br>var nametextNode=document.createTextNode(nameElement.value); <br>var emailtextNode=document.createTextNode(emailElement.value); <br>var addresstextNode=document.createTextNode(addresssElement.value); <br>nameNode.appendChild(nametextNode); <br>emailNode.appendChild(emailtextNode); <br>addressNode.appendChild(addresstextNode); <br><br>} <br></script>
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31