dynamically create\remove textbox
<p>I want to dynamically create\remove textbox . I have a code. I have two file. One html file and other is java script file. Here is my code:</p>

<pre><code>&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;Adding and Removing Text Boxes Dynamically&lt;/title&gt;
        &lt;script type="text/javascript"&gt;
            var intTextBox=0;
            //FUNCTION TO ADD TEXT BOX ELEMENT
            function addElement()
            {
                intTextBox = intTextBox + 1;
                var contentID = document.getElementById('content');
                var newTBDiv = document.createElement('div');
                newTBDiv.setAttribute('id','strText'+intTextBox);
                newTBDiv.innerHTML = "Text "+intTextBox+": &lt;input type='text' id='" + intTextBox + "'    name='" + intTextBox + "'/&gt;";
                contentID.appendChild(newTBDiv);
            }
            //FUNCTION TO REMOVE TEXT BOX ELEMENT
            function removeElement()
            {
                if(intTextBox != 0)
                {
                    var contentID = document.getElementById('content');
                    contentID.removeChild(document.getElementById('strText'+intTextBox));
                    intTextBox = intTextBox-1;
                }
            }
        &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;p&gt;Demo of Adding and Removing Text Box Dynamically using JavaScript&lt;/p&gt;
        &lt;p&gt;&lt;a href="javascript:addElement();" &gt;Add&lt;/a&gt; &lt;a href="javascript:removeElement();" &gt;Remove&lt;/a&gt;&lt;/p&gt;
        &lt;div id="content"&gt;&lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>I want to split this code so that I can write all function in javascript and I want to write this text box code <code>&lt;input type='text' id='" + intTextBox + "' name='" + intTextBox + "'/&gt;";</code> in my html file so that I can use this textbox id to fetch value in compose email since it takes value from textbox id from html pages. Please help.</p>
