简体   繁体   English

创建新的行代码功能不适用于IE8

[英]Create new row code functionality is not working on IE8

I have a code to add more row on link. 我有一个代码可以在链接上添加更多行。 This code is execute on Firefox , Chrome but not on IE-8. 此代码在Firefox和Chrome上执行,但在IE-8上不执行。 Generating error on IE. 在IE上产生错误。 Error is 错误是

Unknown runtime error

Code: 码:

addmore.php 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>&nbsp;</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 addmoreRelative.php

    <?php
$count=$_GET['q']; ?>

<td><input type="text" name="rlast<?php echo $count; ?>" id="rlast<?php echo $count; ?>" /></td>

Known issue. 已知问题。 Updating PART of a table under IE8 and below is simply broken. 在IE8及以下版本中更新表的PART简直就是坏事。

You either have to replace the entire table, or you have to use the traditional DOM table manipulation. 您要么必须替换整个表,要么必须使用传统的DOM表操作。

See JavaScript Table Manipulation for hints. 有关提示,请参见JavaScript表操作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM