我有一个代码可以在链接上添加更多行。此代码在Firefox,Chrome上执行,但在IE-8上不执行。在IE上生成错误。错误是
Unknown runtime error
代码:
addmore.php
<script type="text/javascript" language="javascript">
function addrel()
{
var xmlhttp;
var str1=document.forms["regisration"]["count1"].value;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var taha="reladd"+str1;
document.getElementById(taha).innerHTML=xmlhttp.responseText;
}
}
var str=parseInt(document.forms["regisration"]["count1"].value,10);
xmlhttp.open("GET","addmoreRelative.php?q="+str,true);
xmlhttp.send();
str=str+1;
document.forms["regisration"]["count1"].value=str;
}
</script>
<form name="regisration" method="post" enctype="multipart/form-data" action="">
<input type="hidden" name="count" value="1"/>
<input type="hidden" name="count1" value="1"/>
<table border="0" >
<tr >
<td><b>Surname</b></td>
<td> </td>
</tr>
<tr>
<td >
<input type="text" name="rlast" id="rlast" maxlength="30" value="" />
</td>
<td> <a href="javascript:void()" onClick="addrel()">Add More</a></td>
</tr>
<?php for($t=1;$t<=9;$t++){?><tr id="reladd<?php echo $t; ?>" ></tr><?php }?>
</table>
addmoreRelative.php
<?php
$count=$_GET['q']; ?>
<td><input type="text" name="rlast<?php echo $count; ?>" id="rlast<?php echo $count; ?>" /></td>
答案 0 :(得分:0)