當前位置:編程學習大全網 - 源碼下載 - asp 動態添加文本框點擊添加按鍵後,在表格裏自動向下添加壹行並且添加五個文本框與刪除按鍵

asp 動態添加文本框點擊添加按鍵後,在表格裏自動向下添加壹行並且添加五個文本框與刪除按鍵

,保存數據時可以用ajax來做。以下代碼可參考

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>增加Table行</title>

</head>

<script>

function addRow(obj)

{

//添加壹行

var newTr = testTbl.insertRow();

//添加兩列

var newTd0 = newTr.insertCell();

var newTd1 = newTr.insertCell();

//設置列內容和屬性

newTd0.innerHTML = '<input type=checkbox id="box4">';

newTd1.innerText= '新加行';

}

</script>

<body>

<table id="testTbl" border=1>

<tr id="tr1">

<td ><input type=checkbox id="box1"></td>

<td id="b">第壹行</td>

</tr>

<tr id="tr2">

<td ><input type=checkbox id="box2"></td>

<td id="b">第二行</td>

</tr>

<tr id="tr3">

<td ><input type=checkbox id="box3"></td>

<td>第三行</td>

</tr>

</table>

<br />

<input type="button" id="add" onclick="addRow();" value="Add Row" />

</body>

</html>

  • 上一篇:翼支付借錢系統維護多長時間
  • 下一篇:讀取手機通信源代碼
  • copyright 2024編程學習大全網