title: how to run insertAdjacentElement() function javascript on Chrome, Firefox browser
body: <p>I'm using javascript with some functions in jsp file, when I run on IE, it run good, but run with Chrome or FF, it seem not run.</p>
  
  <p>this is my file:</p>
  
  <pre><code>&lt;script&gt;
  function adds(index, values)
  {   
  if(values.replace(/\s/g, "") == "") {
      alert("Enter the answer and click 'Add' button.");
  
      return;
  }
  
  var frm = document.writeForm;
  var opts=eval("frm.ans_list" + index + ".options");
  var opt=document.createElement("option");    
  opt.value = opts.length + 1;
  opt.innerText = values;
  opts.insertAdjacentElement("beforeEnd",opt);
  
  eval("frm.ans" + index + ".value = '' ");
  
  setting_val(index);
  }
  function up_move(index)
  {
  var frm = document.writeForm;
  var opts=eval("frm.ans_list" + index + ".options");
  
  for (var i=0; i&lt;opts.length; i++) {
      if (opts[i].selected &amp;&amp; i&gt;0) {
          tmp=opts[i].cloneNode(true);
          opts[i].removeNode(true);
          opts[i-1].insertAdjacentElement("beforeBegin",tmp).selected=true;
      }
  }
  
  setting_val(index);
  }
  
  function down_move(index)
  {
  var frm = document.writeForm;
  var opts=eval("frm.ans_list" + index + ".options");
  
  for (var i=opts.length-1; i&gt;=0; i--) {
      if (opts[i].selected &amp;&amp; i&lt;opts.length-1) {
          tmp=opts[i].cloneNode(true);
          opts[i].removeNode(true);
          opts[i].insertAdjacentElement("afterEnd",tmp).selected=true;
      }
  }
  
  setting_val(index);
  }
  &lt;/script&gt;
  
  &lt;body&gt;
     &lt;a href="#" onClick="return adds('&lt;%=i+1%&gt;',document.writeForm.ans&lt;%=i+1%&gt;.value);" style="float:left"&gt;&lt;span class="bt_test_admin bg_type_01"&gt;Add&lt;/span&gt;&lt;/a&gt;
   &lt;/body&gt;
  </code></pre>
  
  <p>Debug on Chrome and FF: </p>
  
  <pre><code>**TypeError: opts.insertAdjacentElement is not a function**
  </code></pre>
  
  <p>I have search a lot of ways but I don't understand why, How to fix this error and run on Chrome and FF?</p>
  
  <p>thanks so much !!</p>