title: Creating text fields according to user's input in JavaScript Function
body: <p>I want to create text fields according to user's input and show the text fields through JavaScript function but this code is not working! </p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Create text Fields according to the users choice!&lt;/title&gt;
  
      &lt;script type="script/JavaScript"&gt;
          function createTextField(){
  
              var userInput = parseInt(document.form2.txtInput.view);
  
              for(var i=0; i&lt;=userInput;i++)
              {
                  document.write('&lt;input type="text"&gt;');
              }
  
  
          }
  
      &lt;/script&gt;
  &lt;/head&gt;
   &lt;form action="http://localhost.WebProg.php" method="post" name="form2"&gt;
      &lt;p&gt;How many text fields you want to create? Enter the number below!&lt;/p&gt;
      Input: &lt;input type="text" name="txtInput"&gt;
      &lt;input type="button" name="btnInput" value="Create" onclick="createTextField();"&gt;
   &lt;/form&gt;
  &lt;/html&gt;
  </code></pre>