为什么加上PHP代码后,动态添加输入框和减少的功能用不了了.
<script LANGUAGE="JAVASCRIPT">
var b = document.from1.anum.value; 
//document.write("b");
var a = b+1; 
function insertRow(){
    if (a<=10){
     var newrow=addtitle.insertRow(addtitle.rows.length);
      var input=newrow.insertCell(0);    
      input.innerHTML=" <a onclick=\"delrow()\" name=\"del"+a+"\"><img src=\"../images/del.gif\" width=\"17\" height=\"19\" align=\"middle\" /></a>"+
" 选项"+a+": <input name=\"optcont[]\" type=\"text\" size=\"45\" maxlength=\"30\" > * ";
      a++;}
    else 
    alert("每一个主题最多只能添加10个选项");
}
function delrow()
{
    if (a-1>1)
    {
    document.getElementById('addtitle').deleteRow(-1);
    a--;
    }
    else
    alert("这是最后一行了,再删就没有了。");
}
</script>
//////////////////////////////////////////////////////////////////////////////////////////////
下面是表单里的内容.
<input type="hidden" name="anum" value="<?php echo $anum; ?>"/>
         <?php 
            $opnum = 0;
            while($opres = mysql_fetch_array($opquery))
            {
                $opnum++;
        ?>               
            <table id="addtitle" width="450" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><a onclick="delrow()"><img src="../images/del.gif" width="17" height="19" align="middle" /></a>
           选项<?php echo $opnum;?>:<input name="optcont[]" type="text" size="45" maxlength="30" value="<?php echo $opres["opt_content"]; ?>"/> *</td>
              </tr>
          </table>
        <?php
            }
        ?>  



 
											





 
	    

 
	
 
											