var e = document.createElement("<input type=hidden name='meizz'>");
document.formName.insertAdjacentElement("afterBefore", e);

解决方案 »

  1.   

    谁能和我说一下怎么改,楼上的.....那个afterBefore是什么?
      

  2.   

    var shtml ="<input type=\"hidden\" name=\"name\" id=\"id\">";
    document.formID.insertAdjacentHTML("BeforeEnd", shtml);
      

  3.   

    insertAdjacentHTML Method--------------------------------------------------------------------------------Inserts the given HTML text into the element at the location.Syntaxobject.insertAdjacentHTML(sWhere, sText)
    ParameterssWhere Required. String that specifies where to insert the HTML text, using one of the following values: beforeBegin Inserts sText immediately before the object. 
    afterBegin Inserts sText after the start of the object but before all other content in the object. 
    beforeEnd Inserts sText immediately before the end of the object but after all other content in the object. 
    afterEnd Inserts sText immediately after the end of the object. 
     
    sText Required. String that specifies the HTML text to insert. The string can be a combination of text and HTML tags. This must be well-formed, valid HTML or this method will fail. 
      

  4.   

    <script>
    <!--
    var e = document.createElement("<input type=hidden name='meizz'>");
    document.formName.insertAdjacentElement("BeforeBegin", e);
    -->
    </script>