Dynamic Text Fields creation JavaScript

The following program will show how to create a Dynamic form by the number of text fields we select from select dropdown

Example

<!DOCTYPE html>
<html>
    <head>
        <script>
            function load(value){
                var string = "";
                for (count = 1; count <= value; ++count) {
                string += "<input type=\"text\" name=" + count + ">" + "<br />";
                }
                
                var form = "<form>";
                form += string;
                form += "</form>";
                
                myDiv.innerHTML = form;
            }
        </script>
    </head>
    <body>
        <select name="k" onChange="load(this.value);">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
            <option value="6">6</option>
        </select>
        <div id="myDiv">
        </div>
    </body>
</html>