zoukankan      html  css  js  c++  java
  • Table动态按列增加删除

    <html>
    	<head>
    		<meta charset="utf-8">
    		<title>动态创建表格增加或者删除列</title>
    		<style type="text/css">
    			table {
    				border-collapse: collapse;
    			}
    
    			tr,
    			td {
    				 80px;
    				height: 20px;
    				border: 1px solid greenyellow;
    				background-color: #FFC0CB;
    			}
    		</style>
    		<script type="text/javascript">
    			window.onload = function() {
    				var oTable = document.createElement("table");
    				oTable.id = "t"
    				for (var i = 0; i < 3; i++) {
    					var oTr = document.createElement("tr");
    					for (var j = 0; j < 3; j++) {
    						var oTd = document.createElement("td");
    						oTr.appendChild(oTd);
    					}
    					oTr.id = i
    					oTable.appendChild(oTr);
    				}
    				document.body.appendChild(oTable);
    				var oBtn = document.getElementById("insb");
    				oBtn.onclick = function() {
    					for (var i = 0; i < 3; i++) {
    						toString(i);
    						var oTr0 = document.getElementById(i);
    						var oTd = document.createElement("td");
    						oTr0.appendChild(oTd);
    					}
    				}
    				var oDel = document.getElementById("delb");
    				oDel.onclick = function() {
    					for (var i = 0; i < 3; i++) {
    						toString(i);
    						var oTr0 = document.getElementById(i);
    						oTr0.removeChild(oTr0.lastElementChild);
    					}
    				}
    			}
    		</script>
    	</head>
    	<body>
    		<input type="button" id="insb" value="ins">
    		<input type="button" id="delb" value="del">
    	</body>
    </html>
  • 相关阅读:
    Python作业之分页显示内容
    Codeforces Round #368 (Div. 2)
    数论专项测试——约数个数和(lucas的数论)
    数论专题测试——逆元
    数论专题测试——幸运数字
    bzoj2219: 数论之神
    bzoj3283: 运算器
    梅森素数
    后缀数组
    Hash_1014: [JSOI2008]火星人prefix
  • 原文地址:https://www.cnblogs.com/miao-study/p/14030238.html
Copyright © 2011-2022 走看看