Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/415.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript html表单崩溃IE 11_Javascript_Html_Forms_Internet Explorer 11 - Fatal编程技术网

Javascript html表单崩溃IE 11

Javascript html表单崩溃IE 11,javascript,html,forms,internet-explorer-11,Javascript,Html,Forms,Internet Explorer 11,我有以下代码 用户填写并提交第一个表单。当他点击“提交”时,数据通过WebSocket存储在数据库中。同时,服务器返回刚刚创建的新id。此id以隐藏形式存储。返回id后,将显示隐藏表单的提交按钮 如果用户想要点击隐藏表单的提交(现在不再隐藏)并转移到另一个页面,在那里id也通过表单转移 在第一种形式中,用户可以点击一个按钮,更多的文本字段将出现,这样他就可以添加数据。这些测试字段的最大数量为10。我自己为此写了JS。通过JS动态添加的字段 这适用于Chrome和Firefox。曾在IE 10中工

我有以下代码

用户填写并提交第一个表单。当他点击“提交”时,数据通过WebSocket存储在数据库中。同时,服务器返回刚刚创建的新id。此id以隐藏形式存储。返回id后,将显示隐藏表单的提交按钮

如果用户想要点击隐藏表单的提交(现在不再隐藏)并转移到另一个页面,在那里id也通过表单转移

在第一种形式中,用户可以点击一个按钮,更多的文本字段将出现,这样他就可以添加数据。这些测试字段的最大数量为10。我自己为此写了JS。通过JS动态添加的字段

这适用于Chrome和Firefox。曾在IE 10中工作。自从IE在IE 11.0.9600.16476中更新以来:

如果我填写并提交第一份表格,就可以了

如果我填写第一张表格,然后点击“全部清除”,即崩溃

如果我填写/提交第一份表格,然后提交第二份表格,即崩溃

我正在使用Windows7

唯一可行的方法是对这些行进行注释

document.getElementById("source").value="";
document.getElementById("contr").value="";
我尽了我的力量和知识。重新编辑,使用JS提交,编辑
enctype
,使用URL传递数据。什么都没有。对我来说再也没有意义了

请,任何建议都行

提前谢谢。我为这个巨大的帖子道歉

这是密码

//globals for links
var gco=1;
var arforl=[];

//save form data and show hidden button of the 2nd form
function save(){
  //edit the data of a field
  var sourceSpace=document.getElementById("source").value; var sourceNoSpace=sourceSpace.replace(/\s/g, '');

  //get all the extra links, put a | betwwen them
  var fst ="|";
  for (var a=0;a < arforl.length; a++){     
     if (document.getElementById(arforl[a]).value!="")
     {fst+=document.getElementById(arforl[a]).value+"|";}
   }

  var ffst = fst.slice(1,fst.length-1);

  var so = new WebSocket("ws://localhost:8000");

  //get all the values from first form and other values, send via websockets
  so.onopen = function(){
   so.send(JSON.stringify({command: 'insertAll',
   name: document.getElementById('name').value,
   geo: hul,
   geoT:'point',
   descr: document.getElementById('descr').value,
   chron: document.getElementById('chron').value,  
   type: document.getElementById('typeselect').value,  
   era: document.getElementById('eraselect').value,  
   lin: document.getElementById('link').value+"|"+ffst,  
   sourc: sourceNoSpace,  
   contr: document.getElementById('contr').value,
   conler:idc

  }));}

  so.onmessage = function (evt) { 
   //get the new id from websockets 
   var received_msg = evt.data;

   //clear the form, show some messages 
   document.getElementById("next").style.display="block";
   document.getElementById("saveB").style.display="block";

   document.getElementById("name").value="";
   document.getElementById("descr").value="";
   document.getElementById("chron").value="";
   document.getElementById("typeselect").value=" ";
   document.getElementById("eraselect").value=" ";
   document.getElementById("link").value="";

     // i have to comment the next lines for this to work
   document.getElementById("source").value="";
   document.getElementById("contr").value="";

   //clear the extra links
   clearLinks();

   //pass the new id in the hidden form
   document.getElementById("pinid").value=received_msg;
   so.close();
   }

}//closes save()


//adds more text fields for links
function moreLink(){
  if (gco!=10){
  var newLinkb=[];

  document.getElementById("extraLink").appendChild(document.createElement("br"));
  newLinkb[gco]= document.createElement('input');
  newLinkb[gco].setAttribute('type','text');
  newLinkb[gco].setAttribute('id',gco);
  newLinkb[gco].setAttribute('onfocus','cleari()');
  document.getElementById("extraLink").appendChild(newLinkb[gco]);
  arforl.push(gco);             
  gco++;
  }

 else
 {document.getElementById("extraLink2").innerHTML="max is 10";}

}

//clears the extra links
function clearLinks(){
 for (var d=0;d < arforl.length; d++){
 document.getElementById(arforl[d]).value="";
    }
}

function clearall(){
          document.getElementById("name").value="";
          document.getElementById("descr").value="";
          document.getElementById("chron").value="";
          document.getElementById("typeselect").value=" ";
          document.getElementById("eraselect").value=" ";
          document.getElementById("link").value="";
     // i have to comment the next lines for this to work
          document.getElementById("source").value="";
          document.getElementById("contr").value="";    
}
//链接的全局变量
var gco=1;
var arforl=[];
//保存表单数据并显示第二个表单的隐藏按钮
函数save(){
//编辑字段的数据
var sourceSpace=document.getElementById(“source”).value;var sourceNoSpace=sourceSpace.replace(/\s/g');
//获取所有额外链接,在它们之间放置一个|
var fst=“|”;
对于(var a=0;a
HTML:

第一种形式:

<form  name="inserterPoint" action="#" method="post" enctype="multipart/form-data">
Name <br>
<input name="name" id="name" class="textformfront" type="text" required  >

Description<br>
<textarea name="descr" id="descr" class="textformfront" rows="24" cols="50" required ></textarea>

Chronology
<input name="chron" id="chron" class="textformfront" type="text" required  >


  Type : <br>
  <select name="typeselect" id="typeselect" >
    <option selected value=" ">Pick one</option>
    <?php
      for ($d=0; $d< sizeof($typos) ; $d++)
           {echo '"<option value="'.$tid[$d].'" typeselect='.$tid[$d].'>'.$typos[$d].'</option>';}
    ?>
  </select>

 Era:<br>
  <select name="eraselect" id="eraselect" >
    <option selected value=" ">Pick one</option>
    <?php 
        for ($g=0; $g< sizeof($era) ; $g++)
             {echo '"<option value="'.$eid[$g].'" eraselect='.$eid[$g].'>'.$era[$g].'</option>';}
       ?>
  </select>

Links<br>
 <input name="link" id = "link" type="text" class="textformfront" required >

  <div id="extraLink"></div>
  <input type="button" onClick="moreLink();" value="More links" class="formButtonMap">

  <div id="extraLink2"></div>

Sources<br>
  <textarea name="source" id= "source" class="textformfront"  rows="24" cols="50" required ></textarea>

Contributors
<textarea name="contr" id="contr" class="textformfront"   rows="24" cols="50" ></textarea>

<input type="button"  id="clearAll" value="Clear All" class="formButtonMap" onClick="clearall();>


<input type="button"  id="saveB" value="Save All" class="formButtonMap" onClick="save();" style="display:none">

名称
说明
年表 类型:
挑一个 时代:
挑一个 链接
来源
贡献者
与其设置“contr”和“source”
.value
属性,不如尝试设置它的
.innerHTML
属性。我不知道这是否会有所不同,但是…

以下内容是否解决了崩溃行为

document.getElementById("source").value=" ";
document.getElementById("contr").value=" ";
document.getElementById("source").value="";
document.getElementById("contr").value="";

当你说“IE崩溃”时,你的意思是整个浏览器进程都失败了吗?那么你的意思是将
textarea
的值设置为
会导致IE11崩溃。你能用一个小的测试用例重现它吗,还是只在这个大的应用程序中重现它?@尖锐的好问题。我只是编辑我的答案。希望如此helps@Barmar谢谢你编辑这个问题。我还补充了细节。不,不是真的,没有意义。为什么是这两个文本区域,而不是其他区域?起初我认为这和我写的关于链接的JS有关。我发表了评论,问题仍然存在。在测试中复制需要一段时间。因为这是一个900行php文件的一部分。请检查这个问题:这是一个IE11错误。查看我问题下方的评论,并查看Josh Berke建议的链接
document.getElementById("source").value=" ";
document.getElementById("contr").value=" ";
document.getElementById("source").value="";
document.getElementById("contr").value="";