行
<input type="button" value="插入" onclick="insert_row()"> <table name='tbl' id="tbl" border="1" width=300>
</table>
<script>
var i=0
function insert_row(){
i++
R=tbl.insertRow()
C=R.insertCell()
C.innerHTML="<input type='file' name='file' >"
C=R.insertCell()
C.innerHTML="文件"+i
C=R.insertCell()
C.innerHTML="<input type='button' value='删除' onclick='tbl.deleteRow("+(i-1)+")'>" }
</script>
列
<script>
function creates(){
newiframes=document.createElement("TABLE")
newiframes.id="t1"
newiframes.width="100"
newiframes.border="1"
newiframes.height="100"
newiframes.align="left"
newiframes.style.background="red"
newiframes.insertRow()
newiframes.rows[0].insertCell()
document.body.insertBefore(newiframes)
}
</script>
<body>
<input type=button value='加一个表格' onclick=creates()><br>
</body>
<input type="button" value="插入" onclick="insert_row()"> <table name='tbl' id="tbl" border="1" width=300>
</table>
<script>
var i=0
function insert_row(){
i++
R=tbl.insertRow()
C=R.insertCell()
C.innerHTML="<input type='file' name='file' >"
C=R.insertCell()
C.innerHTML="文件"+i
C=R.insertCell()
C.innerHTML="<input type='button' value='删除' onclick='tbl.deleteRow("+(i-1)+")'>" }
</script>
列
<script>
function creates(){
newiframes=document.createElement("TABLE")
newiframes.id="t1"
newiframes.width="100"
newiframes.border="1"
newiframes.height="100"
newiframes.align="left"
newiframes.style.background="red"
newiframes.insertRow()
newiframes.rows[0].insertCell()
document.body.insertBefore(newiframes)
}
</script>
<body>
<input type=button value='加一个表格' onclick=creates()><br>
</body>
解决方案 »
- Extjs GridPanel中reader为Ext.data.ArrayReader如何进行data的添删改查
- 请问 mootools 这个框架的名字是什么意思?
- 请高手帮我看看哪错了
- obj.disabled=false IE6下无效
- JS控制COOKIE??
- 请教在JS中怎么获取和设置iframe的src属性?
- 请教一下if (window == top)是什么意思
- 急,怎么访问jquery.load取回后的html元素
- 请教:请问在 javaScript 中实数怎样保留如3位小数显示?
- 链接问题 望赐教 在线等候
- 一个 showModelessDialog 的难题!!
- 如何写JAVASCRIPT判断是否按下了DEL键
<input type="button" value="addRow" onclick="addRow()">
<input type="button" value="deleteRow" onclick="deleteRow()">
<script>
function addRow(){
var newTr=tbl.insertRow(),newTd
newTd=newTr.insertCell()
newTd.innerText="abc";
newTd=newTr.insertCell()
newTd.innerText="xyz";
}function deleteRow(){
if(tbl.rows.length ==0) return
tbl.deleteRow(tbl.rows.length - 1)
}
</script>