【询问】有关JS动态画表格
时间:2011-08-10
来源:互联网
请教 一下 JS动态画表格的问题
<TABLE cellSpacing=0 borderColorDark=#ffffff width="80%" id="tablecode11" borderColorLight=#424b8c border=1>
<tbody id="contractTable">
<tr>
<td rowSpan="1" scope="row">
<input type='radio' class='submit' name='contractOperation' value='contractOperation'/>
</td>
<TD width="18%" bgColor=#d1d5e9><font color="#ff0000">*</font><FONT color=#000066>合同责任金额</TD>
<TD width="30%" >
<table id='dutyMoneyTB' >
<tr><td><input type="button" value="新增" onclick="addMoney('dutyMoneyTB','dutyMoney','dutyMoneyId');" ></td></tr>
<tr><td>
<input need="true" disName="合同责任金额" ifNo="true" name="dutyMoney" value="" type="text" size="15">
<select name="dutyMoneyId">
<c:forEach items="${coinTypes}" var="coinType" >
<option <c:if test="${'USD'==coinType}">selected </c:if> value='<c:out value="${coinType}"/>'><c:out value="${coinType}"/></option>
</c:forEach>
</s elect>
</td></tr>
</table>
</TD>
<TD width="24%" bgColor=#d1d5e9><font color="#ff0000">*</font><FONT color=#000066>合同期限</TD>
<TD width="28%" ><input need="true" disName="合同期限" ifNo="true" name="contractPeriod" type="text" > <FONT color=#000066>月</FONT></TD>
</tr>
</tbody>
</TABLE>
下面是我的JS源码
function addContract(){
var sRow;
var sCell;
var sTable;
sRow = document.createElement("tr");
document.getElementById("contractTable").appendChild(sRow);
sCell = document.createElement("td");
sCell.rowSpan="1";
sCell.scope="row";
sCell.innerHTML = "<input type='radio' class='submit' name='contractOperation' value='contractOperation'/>";
sRow.appendChild(sCell);
sCell = document.createElement("td");
sCell.bgColor="#D1D5E9";
sCell.innerHTML = "<font color='#ff0000'>*</font><font color='#000066'>合同责任金额</font>";
sRow.appendChild(sCell);
sCell = document.createElement("td");
sRow.appendChild(sCell);
sTable = document.createElement("table");
sTable.setAttribute("id","dutyMoneyTB");
sRow.appendChild(sCell);
sRow = document.createElement("tr");
document.getElementById("dutyMoneyTB").appendChild(sRow);
sCell = document.createElement("td");
sCell.innerHTML = "<input type='button' value='新增' onclick='addMoney('dutyMoneyTB','dutyMoney','dutyMoneyId');' >";
sRow.appendChild(sCell);
}
当执行到最后一块时 怎么都不出来那个新增按钮 请问怎么解决?
<TABLE cellSpacing=0 borderColorDark=#ffffff width="80%" id="tablecode11" borderColorLight=#424b8c border=1>
<tbody id="contractTable">
<tr>
<td rowSpan="1" scope="row">
<input type='radio' class='submit' name='contractOperation' value='contractOperation'/>
</td>
<TD width="18%" bgColor=#d1d5e9><font color="#ff0000">*</font><FONT color=#000066>合同责任金额</TD>
<TD width="30%" >
<table id='dutyMoneyTB' >
<tr><td><input type="button" value="新增" onclick="addMoney('dutyMoneyTB','dutyMoney','dutyMoneyId');" ></td></tr>
<tr><td>
<input need="true" disName="合同责任金额" ifNo="true" name="dutyMoney" value="" type="text" size="15">
<select name="dutyMoneyId">
<c:forEach items="${coinTypes}" var="coinType" >
<option <c:if test="${'USD'==coinType}">selected </c:if> value='<c:out value="${coinType}"/>'><c:out value="${coinType}"/></option>
</c:forEach>
</s elect>
</td></tr>
</table>
</TD>
<TD width="24%" bgColor=#d1d5e9><font color="#ff0000">*</font><FONT color=#000066>合同期限</TD>
<TD width="28%" ><input need="true" disName="合同期限" ifNo="true" name="contractPeriod" type="text" > <FONT color=#000066>月</FONT></TD>
</tr>
</tbody>
</TABLE>
下面是我的JS源码
function addContract(){
var sRow;
var sCell;
var sTable;
sRow = document.createElement("tr");
document.getElementById("contractTable").appendChild(sRow);
sCell = document.createElement("td");
sCell.rowSpan="1";
sCell.scope="row";
sCell.innerHTML = "<input type='radio' class='submit' name='contractOperation' value='contractOperation'/>";
sRow.appendChild(sCell);
sCell = document.createElement("td");
sCell.bgColor="#D1D5E9";
sCell.innerHTML = "<font color='#ff0000'>*</font><font color='#000066'>合同责任金额</font>";
sRow.appendChild(sCell);
sCell = document.createElement("td");
sRow.appendChild(sCell);
sTable = document.createElement("table");
sTable.setAttribute("id","dutyMoneyTB");
sRow.appendChild(sCell);
sRow = document.createElement("tr");
document.getElementById("dutyMoneyTB").appendChild(sRow);
sCell = document.createElement("td");
sCell.innerHTML = "<input type='button' value='新增' onclick='addMoney('dutyMoneyTB','dutyMoney','dutyMoneyId');' >";
sRow.appendChild(sCell);
}
当执行到最后一块时 怎么都不出来那个新增按钮 请问怎么解决?
作者: ieycl 发布时间: 2011-08-10
input标签里包含中文的引号,或者把onclice事件删了,看看会不会出按钮。
作者: scundy 发布时间: 2011-08-11
addMoney找不到,没法调试
作者: softroad 发布时间: 2011-08-11
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28