+ -
当前位置:首页 → 问答吧 → 【询问】有关JS动态画表格

【询问】有关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" > &nbsp;<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

热门下载

更多