HTMl 添加
来源:互联网 发布:unity3d无缝地图 编辑:程序博客网 时间:2024/06/03 15:17
<script>function tj() {var xj_tr = document.createElement("tr");var shuju_name = document.getElementById("a_name");var shuju_age = document.getElementById("a_age");var shuju_buil = document.getElementById("a_buil");if(isNaN(shuju_age.value) == false) {var ipp = document.getElementById("ip");ipp.innerText = "";var tianjia_name = document.createElement("td");var tianjia_age = document.createElement("td");var tianjia_buil = document.createElement("td");var tianjia_shanchu = document.createElement("td");tianjia_name.innerText = shuju_name.value;tianjia_age.innerText = shuju_age.value;tianjia_buil.innerText = shuju_buil.value;var shanchu = document.createElement("button");shanchu.innerText = "刪除";shanchu.onclick = function() {this.parentNode.remove();}tianjia_shanchu.appendChild(shanchu);xj_tr.appendChild(tianjia_name);xj_tr.appendChild(tianjia_age);xj_tr.appendChild(tianjia_buil);xj_tr.appendChild(shanchu);var z = document.getElementById("z_table");z.appendChild(xj_tr);} else {var ipp = document.getElementById("ip");ipp.innerText = "年齡輸入不對";}}</script>
<font>姓名 </font><input type="text" id="a_name" /><font>年齡</font><input type="text" id="a_age" /><font>生日</font><input type="text" id="a_buil" /><input type="button" value="添加" onclick="tj()" /><br /><p id="ip"></p><br /><table border="1" id="z_table"><tr><th width="100px">姓名</th><th width="100px">年齡</th><th width="100px">生日</th><th width="100px">删除</th></tr></table>
阅读全文
0 0
- HTMl 添加
- 添加html内容(insertAdjacentHTML)
- 动态添加html内容
- HTML 动态添加控件
- html里添加flash
- HTML - 添加到收藏夹
- html添加tooltip
- HTML中添加虚线
- Html table添加空行
- 在html 添加flash
- jQuery添加删除html
- Html:网页添加背景音乐
- html添加flash
- html添加链接
- 添加、删除HTML元素
- html favorite 添加
- html超链接添加下划线
- js实现添加HTML
- HDOJ2156分数矩阵
- 1013: [JSOI2008]球形空间产生器sphere
- Android Intent 小结
- 优化算法——牛顿法和拟牛顿法
- 【HNOI2017】礼物-gift
- HTMl 添加
- 搭建SSM常用配置spring-service
- 机器学习储备(13):概率密度和高斯分布例子解析
- python---控制时间的函数time()
- MongoDB升级小结
- Akka(39): Http:File streaming-文件交换
- XML
- C++中cin.get(),cin.getLine(),getChar(),getch()的区别
- 负载均衡