js添加table行,js动态添加table行 ,js添加行,javascript添加行,动态添加行,动态添加列
<html>
<head>
<script type="text/javascript">
function creat_rowcols(selectValue)
{
var table = document.getElementById("bb");
var rowCount=table.rows.length;
if( rowCount>0)
{
for(var i=0;i<rowCount;i++)
{ var tr=document.getElementsByTagName("TR")[0];
tr.parentNode.removeChild(tr);
}
}
table.border=0;
var row;
for(var i=0;i<10;i++)
{
if(i%6==0){
row=table.insertRow();
}
var cell=row.insertCell(0);
cell.innerHTML="<input type='checkbox' name='cusername' size='15' value=''>小名"+selectValue+i;
}
}
</script>
</head>
<body>
<form action="" method="post">
<div><select name="aa" onchange="creat_rowcols(this.value);">
<option value="选项一">1</option>
<option value="选项二">2</option>
<option value="选项三">3</option>
</select>
</div>
<table border="1" name="aa" id="bb">
</table>
</form>
</body>
</html>
中国足彩网信息请查看IT技术专栏