lundi 4 juillet 2016

dynamic textbox in pressing enter key

can someone help me with my code? everytime I type in my textbox it create multiple textbox but I want to create a program that everytime I hit enter key it create another textbox.

here's my code:

<script language="javascript">
    function changeIt() {
     var i = 1;
     my_div.innerHTML = my_div.innerHTML +"<br><input type='text' name='mytext'+ i><br/>"
    }
</script>
<body>
    <form name="form" action="post" method="">
      <input type="text" name=t1 onkeydown="changeIt()">
      <div id="my_div"></div>
    </form>
</body>

Aucun commentaire:

Enregistrer un commentaire