<!--
var count = 1;function addItem(){
count = count + 1;
var e=window.event.srcElement;
var tr1=e.parentElement.parentElement;
var tr2=mainTable.insertRow();
tr2.className="biaodan-q";
tr2.insertCell().innerHTML=' <input type="button" value="删除" onclick="javascript:deleteItem();" title="'+count+'">';
tr2.insertCell().innerHTML=' <input type="button" value="保存" onclick="javascript:getServerHtml();" title="'+count+'">'; tr2.insertCell().innerHTML=' <input name="textfield" type="text" size="20">'; tr2.insertCell().innerHTML=' <input name="textfield2" type="text" size="10">'; tr2.insertCell().innerHTML=' <select name="select3" class="kuang"><option>――</option><option selected>任务B</option></select>'; tr2.insertCell().innerHTML=" <input name='STARTDate"+count+"' type=text class=kuang id='STARTDate"+count+"' title='STARTDate"+count+"' value=2007-01-01 size=12> <a href='#' onClick='javascript:popUpCalendar(this, window.document.getElementById('STARTDate1'), 'yyyy-mm-dd');'><img src='../images/Date.gif' width='20' height='19' border='0' align='absmiddle'></a>";
tr2.insertCell().innerHTML=" <input name='ENDDate"+count+"' type=text class=kuang id='ENDDate"+count+"' title='ENDDate"+count+"' value=2007-01-01 size=12> <img src='../images/Date.gif' width='20' height='19' border='0' align='absmiddle'></a>"; tr2.insertCell().innerHTML=' <textarea name="textarea" cols="25" rows="2"></textarea>';
}
JS报错,说语法错误.本人愚钝,没检查出来,功能是这样的,想动态的为表格添加一行进行数据录入.谢谢大家帮忙.........我测试得出报错的代码是(功能为选择起始日期,调用日历控件(JS)...):
tr2.insertCell().innerHTML=" <input name='STARTDate"+count+"' type=text class=kuang id='STARTDate"+count+"' title='STARTDate"+count+"' value=2007-01-01 size=12> <a href='#' onClick='javascript:popUpCalendar(this, window.document.getElementById('STARTDate1'), 'yyyy-mm-dd');'><img src='../images/Date.gif' width='20' height='19' border='0' align='absmiddle'></a>";
tr2.insertCell().innerHTML=" <input name='ENDDate"+count+"' type=text class=kuang id='ENDDate"+count+"' title='ENDDate"+count+"' value=2007-01-01 size=12> <img src='../images/Date.gif' width='20' height='19' border='0' align='absmiddle'></a>";
var count = 1;function addItem(){
count = count + 1;
var e=window.event.srcElement;
var tr1=e.parentElement.parentElement;
var tr2=mainTable.insertRow();
tr2.className="biaodan-q";
tr2.insertCell().innerHTML=' <input type="button" value="删除" onclick="javascript:deleteItem();" title="'+count+'">';
tr2.insertCell().innerHTML=' <input type="button" value="保存" onclick="javascript:getServerHtml();" title="'+count+'">'; tr2.insertCell().innerHTML=' <input name="textfield" type="text" size="20">'; tr2.insertCell().innerHTML=' <input name="textfield2" type="text" size="10">'; tr2.insertCell().innerHTML=' <select name="select3" class="kuang"><option>――</option><option selected>任务B</option></select>'; tr2.insertCell().innerHTML=" <input name='STARTDate"+count+"' type=text class=kuang id='STARTDate"+count+"' title='STARTDate"+count+"' value=2007-01-01 size=12> <a href='#' onClick='javascript:popUpCalendar(this, window.document.getElementById('STARTDate1'), 'yyyy-mm-dd');'><img src='../images/Date.gif' width='20' height='19' border='0' align='absmiddle'></a>";
tr2.insertCell().innerHTML=" <input name='ENDDate"+count+"' type=text class=kuang id='ENDDate"+count+"' title='ENDDate"+count+"' value=2007-01-01 size=12> <img src='../images/Date.gif' width='20' height='19' border='0' align='absmiddle'></a>"; tr2.insertCell().innerHTML=' <textarea name="textarea" cols="25" rows="2"></textarea>';
}
JS报错,说语法错误.本人愚钝,没检查出来,功能是这样的,想动态的为表格添加一行进行数据录入.谢谢大家帮忙.........我测试得出报错的代码是(功能为选择起始日期,调用日历控件(JS)...):
tr2.insertCell().innerHTML=" <input name='STARTDate"+count+"' type=text class=kuang id='STARTDate"+count+"' title='STARTDate"+count+"' value=2007-01-01 size=12> <a href='#' onClick='javascript:popUpCalendar(this, window.document.getElementById('STARTDate1'), 'yyyy-mm-dd');'><img src='../images/Date.gif' width='20' height='19' border='0' align='absmiddle'></a>";
tr2.insertCell().innerHTML=" <input name='ENDDate"+count+"' type=text class=kuang id='ENDDate"+count+"' title='ENDDate"+count+"' value=2007-01-01 size=12> <img src='../images/Date.gif' width='20' height='19' border='0' align='absmiddle'></a>";
'javascript:popUpCalendar(this, window.document.getElementById( 'STARTDate1"+conut+" '), 'yyyy-mm-dd '); '>
写法有错误
document.getElementById("STARTDate1"+conut)
tr2.insertCell().innerHTML= " <input name= 'STARTDate "+count+ " ' type=text class=kuang id= 'STARTDate "+count+ " ' title= 'STARTDate "+count+ " ' value=2007-01-01 size=12> <a href= '# ' onClick= \"javascript:popUpCalendar(this, window.document.getElementById( 'STARTDate1 '), 'yyyy-mm-dd '); \"> <img src= '../images/Date.gif ' width= '20 ' height= '19 ' border= '0 ' align= 'absmiddle '> </a> ";里面引号用错了;\"javascript:popUpCalendar(this, window.document.getElementById( 'STARTDate1 '), 'yyyy-mm-dd '); \"
............解决了