NS_ERROR_XPC_BAD_CONVERT_JS , when creating a new form and input fields
<p>i am new to javascript and i have been trying things out lately . but i am stuck here in one function which return the error :</p>

<pre><code>[10:55:47.027] NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument arg 0 [nsIDOMHTMLFormElement.appendChild] @ http://localhost/myproj/test5.html:15
</code></pre>

<p>Now let me explain what the code does :
1) i have defined a function called "add" it takes one argument which is a arary of strings.
when it is called , the function creates a  new form and new input's with type "text" and value the same as each string in the argument array.</p>

<p>here is the code : </p>

<pre><code>function add(index_array) {

//create the form
    var myform = document.createElement("form");
    myform.id="k_form"
    for ( i =0 ; i &lt;index_array.length ; i ++)
    {
        var mytext = document.createElement("input");
        mytext.tpye="text";
        mytext.value="index_array[i]";
        mytext.id="index_array[i]";
        myform.appendChild("mytext");
        console.log("error");
    }
mydiv=document.getElementById("d_div");
mydiv.appendChild("myform");
}
</code></pre>

<p>now when i execute it , i get the error displayed above , i cant figure out my mistake can anyone please help with that.
thanks a ton!</p>
