<form action="upload.asp" enctype="multipart/form-data" name="form1" method="post">
<input name="free_date1" type="text" id="arrive_date1" size="15" value="点击选择日期" style="width:100px; height:21px;" onfocus="javascript:setday(this)" />
<a href="#"  onclick="addNew()"><span style="color:#333333;font-size:12px;">增加时段<span></a>
</form>
日历在以上表单中能显示,但在用js增加的行中(代码如下)却不能显示了,为什么呢?求教。<script language="JavaScript">
var i=11
function addNew()
{
    tr=document.getElementById("t136").insertRow();
    tr.insertCell().innerHTML='<input name=free_date1 type=text id=arrive_date1 size="15" value=点击选择日期" style=width:100px; height:21px; onfocus=javascript:setday(this) />'
}
</script>

解决方案 »

  1.   

    <script language="JavaScript">
    var i=11
    function addNew()
    {
      tr=document.getElementById("t136").insertRow();
      tr.insertCell().innerHTML='<input name=free_date1 type=text id=arrive_date1 size=15 value=点击选择日期" style=width:100px; height:21px; onfocus=javascript:setday(this) />'
    }
    </script> 这段代码有什么问题么?
      

  2.   


    tr.insertCell().innerHTML='<input name=free_date1 type=text id=arrive_date1 size="15" value="点击选择日期" style=width:100px; height:21px; onfocus=javascript:setday(this) />'点击选择日期那里是不是少了个"
      

  3.   

    tr=document.getElementById("t136").insertRow();
    这句问题很大,首先你的页面有id为t136的元素吗?
    其次,insertRow()和insertCell()是表格标签的专用方法。而且firefox下不能省略参数。