问题解决了,改成以下这样,但是现在在IE下控件出不来,在FIREFOX上就没问题
<html>
<head>
<title>动态增加文本框 </title>
<script type="text/javascript" src="js/calendar.js"> </script>
<script type="text/javascript" src="js/calendar-zh.js"> </script> <script type="text/javascript" src="js/calendar-setup.js"> </script>
<script type="text/javascript">
<!-- var textNumber = 1;
function addTitle(rows){
return "提醒" + (rows+1) + ":";
}
function addaa(rows){
//return rows;
return " <input type=\"+text\" name=\"aa[]" + rows + "\" id=\"begin_date_b" + rows + "\" />" + " <input type=\"reset\" value=\"...\" onclick=\"return showCalendar('begin_date_b" + rows + "', 'y-m-d');\">";
}
function addbb(rows){
//return rows
return " <input type=\"+text\" name=\"bb[]" + rows + "\" id=\"bb" + rows + "\" />";
}
function addtt(rows){
//return rows;
return " <input type=\"+text\" name=\"tt[]" + rows + "\" id=\"tt" + rows + "\" />";
}
function addTextBox(worksId){
var works = document.getElementById(worksId);
var newRow = works.insertRow(-1);
var newCell = newRow.insertCell(0);
newCell.innerHTML = addTitle(textNumber);
newCell = newRow.insertCell(1);
newCell.innerHTML = addtt(textNumber);
newCell = newRow.insertCell(2);
newCell.innerHTML = addaa(textNumber);
newCell = newRow.insertCell(3);
newCell.innerHTML = addbb(textNumber);
textNumber++;
}
function removeTextBox(worksId){
var works = document.getElementById(worksId);
if(textNumber>1){
works.deleteRow(textNumber-2);
textNumber--;
}
}
//-->
</script>
<style type="text/css">
<!--
label {
display:block;
margin:.25em 0em;
}
-->
</style>
</head>
<body> <form method="POST" action="bb6cc.php">
<table border="0" id="works" cellpadding="0" cellspacing="0">
<label id="template">提醒1: <input type="text" name="tt[]" id="tt" />
<input type="text" name="aa[]" id="begin_date_b"> <input type="reset" value="..." onclick="return showCalendar('begin_date_b', 'y-m-d');">
<input type="text" name="bb[]" id="bb" /> </label>
<table id="works">
</table>
<p>
<input type="button" value="增加一行" onclick="addTextBox('works')" />
<input type="button" value="删除一行" onclick="removeTextBox('works')" />
<p> <input type="Submit" value="提交保存" /> </p>
</form>
</body>
</html>
<html>
<head>
<title>动态增加文本框 </title>
<script type="text/javascript" src="js/calendar.js"> </script>
<script type="text/javascript" src="js/calendar-zh.js"> </script> <script type="text/javascript" src="js/calendar-setup.js"> </script>
<script type="text/javascript">
<!-- var textNumber = 1;
function addTitle(rows){
return "提醒" + (rows+1) + ":";
}
function addaa(rows){
//return rows;
return " <input type=\"+text\" name=\"aa[]" + rows + "\" id=\"begin_date_b" + rows + "\" />" + " <input type=\"reset\" value=\"...\" onclick=\"return showCalendar('begin_date_b" + rows + "', 'y-m-d');\">";
}
function addbb(rows){
//return rows
return " <input type=\"+text\" name=\"bb[]" + rows + "\" id=\"bb" + rows + "\" />";
}
function addtt(rows){
//return rows;
return " <input type=\"+text\" name=\"tt[]" + rows + "\" id=\"tt" + rows + "\" />";
}
function addTextBox(worksId){
var works = document.getElementById(worksId);
var newRow = works.insertRow(-1);
var newCell = newRow.insertCell(0);
newCell.innerHTML = addTitle(textNumber);
newCell = newRow.insertCell(1);
newCell.innerHTML = addtt(textNumber);
newCell = newRow.insertCell(2);
newCell.innerHTML = addaa(textNumber);
newCell = newRow.insertCell(3);
newCell.innerHTML = addbb(textNumber);
textNumber++;
}
function removeTextBox(worksId){
var works = document.getElementById(worksId);
if(textNumber>1){
works.deleteRow(textNumber-2);
textNumber--;
}
}
//-->
</script>
<style type="text/css">
<!--
label {
display:block;
margin:.25em 0em;
}
-->
</style>
</head>
<body> <form method="POST" action="bb6cc.php">
<table border="0" id="works" cellpadding="0" cellspacing="0">
<label id="template">提醒1: <input type="text" name="tt[]" id="tt" />
<input type="text" name="aa[]" id="begin_date_b"> <input type="reset" value="..." onclick="return showCalendar('begin_date_b', 'y-m-d');">
<input type="text" name="bb[]" id="bb" /> </label>
<table id="works">
</table>
<p>
<input type="button" value="增加一行" onclick="addTextBox('works')" />
<input type="button" value="删除一行" onclick="removeTextBox('works')" />
<p> <input type="Submit" value="提交保存" /> </p>
</form>
</body>
</html>
<head>
<title>动态增加文本框 </title>
<link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-cold-1.css" title="win2k-cold-1" />
<script type="text/javascript" src="js/calendar.js"> </script>
<script type="text/javascript" src="js/calendar-zh.js"> </script> <script type="text/javascript" src="js/calendar-setup.js"> </script>
<script type="text/javascript">
<!-- var textNumber = 1;
function addTitle(rows){
return "提醒" + (rows+1) + ":";
}
function addaa(rows){
//return rows;
return " <input type=\"+text\" name=\"aa[]" + rows + "\" id=\"begin_date_b" + rows + "\" />" + " <input type=\"reset\" value=\"...\" onclick=\"return showCalendar('begin_date_b" + rows + "', 'y-m-d');\">";
}
function addbb(rows){
//return rows
return " <input type=\"+text\" name=\"bb[]" + rows + "\" id=\"bb" + rows + "\" />";
}
function addtt(rows){
//return rows;
return " <input type=\"+text\" name=\"tt[]" + rows + "\" id=\"tt" + rows + "\" />";
}
function addTextBox(worksId){
var works = document.getElementById(worksId);
var newRow = works.insertRow(-1);
var newCell = newRow.insertCell(0);
newCell.innerHTML = addTitle(textNumber);
newCell = newRow.insertCell(1);
newCell.innerHTML = addtt(textNumber);
newCell = newRow.insertCell(2);
newCell.innerHTML = addaa(textNumber);
newCell = newRow.insertCell(3);
newCell.innerHTML = addbb(textNumber);
textNumber++;
}
function removeTextBox(worksId){
var works = document.getElementById(worksId);
if(textNumber>1){
works.deleteRow(textNumber-2);
textNumber--;
}
}
//-->
</script>
<style type="text/css">
<!--
label {
display:block;
margin:.25em 0em;
}
-->
</style>
</head>
<body> <form method="POST" action="bb6cc.php">
<table border="1" id="works" cellpadding="0" cellspacing="0">
<tr align="center"><td></td><td>提醒内容</td><td>提醒时间</td><td>提醒邮件</td></tr>
<tr><td>提醒1:</td> <td><input type="text" name="tt[]" id="tt" /> </td>
<td><input type="text" name="aa[]" id="begin_date_b"> <input type="reset" value="..." onclick="return showCalendar('begin_date_b', 'y-m-d');"> </td>
<td><input type="text" name="bb[]" id="bb" /> </td></label>
</tr>
</table>
<p>
<input type="button" value="增加一行" onclick="addTextBox('works')" />
<input type="button" value="删除一行" onclick="removeTextBox('works')" />
<p> <input type="Submit" value="提交保存" /> </p>
</form>
</body>
</html>
主要是:<input type="text" name="aa[]" id="begin_date_b"> <input type="reset" value="..." onclick="return showCalendar('begin_date_b', 'y-m-d');"> 多了个空格js:
return " <input type=\"+text\" name=\"aa[]" + rows + "\" id=\"begin_date_b" + rows + "\" />" + " <input type=\"reset\" value=\"...\" onclick=\"return showCalendar('begin_date_b" + rows + "', 'y-m-d');\">";里面也多了个。
<html>
<head>
<title>动态增加文本框 </title>
<link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-cold-1.css" title="win2k-cold-1" />
<script type="text/javascript" src="js/calendar.js"> </script>
<script type="text/javascript" src="js/calendar-zh.js"> </script>
<script type="text/javascript" src="js/calendar-setup.js"> </script>
<script type="text/javascript">
<!-- var textNumber = 1;
function addTitle(rows){
return "提醒" + (rows+1) + ":";
}
function addaa(rows){
//return rows;
return " <input type=\"+text\" name=\"aa[]" + rows + "\" id=\"begin_date_b" + rows + "\" />" + "<input type=\"reset\" value=\"...\" onclick=\"return showCalendar('begin_date_b" + rows + "', 'y-m-d');\">";
}
function addbb(rows){
//return rows
return " <input type=\"+text\" name=\"bb[]" + rows + "\" id=\"bb" + rows + "\" />";
}
function addtt(rows){
//return rows;
return " <input type=\"+text\" name=\"tt[]" + rows + "\" id=\"tt" + rows + "\" />";
}
function addTextBox(worksId){
var works = document.getElementById(worksId);
var newRow = works.insertRow(-1);
var newCell = newRow.insertCell(0);
newCell.innerHTML = addTitle(textNumber);
newCell = newRow.insertCell(1);
newCell.innerHTML = addtt(textNumber);
newCell = newRow.insertCell(2);
newCell.innerHTML = addaa(textNumber);
newCell = newRow.insertCell(3);
newCell.innerHTML = addbb(textNumber);
textNumber++;
}
function removeTextBox(worksId){
var works = document.getElementById(worksId);
if(textNumber>1){
works.deleteRow(textNumber-2);
textNumber--;
}
}
//-->
</script>
<style type="text/css">
<!--
label {
display:block;
margin:.25em 0em;
}
-->
</style>
</head>
<body><form method="POST" action="bb6cc.php">
<table border="1" id="works" cellpadding="0" cellspacing="0">
<tr align="center"> <td> </td> <td>提醒内容 </td> <td>提醒时间 </td> <td>提醒邮件 </td> </tr>
<tr> <td>提醒1: </td> <td> <input type="text" name="tt[]" id="tt" /> </td>
<td> <input type="text" name="aa[]" id="begin_date_b"><input type="reset" value="..." onClick="return showCalendar('begin_date_b', 'y-m-d');"></td>
<td> <input type="text" name="bb[]" id="bb" /> </td> </label>
</tr>
</table>
<p>
<input type="button" value="增加一行" onClick="addTextBox('works')" />
<input type="button" value="删除一行" onClick="removeTextBox('works')" />
<p> <input type="Submit" value="提交保存" /> </p>
</form>
</body>
</html>