Hello guyz, I don't know how its called this tutorial to google it so I need your help. I want to write on a input text X (where X is a number) and when hitting the button... to show on the same page X input texts. Any ideas ?
Is this what you are looking for? <script language="JavaScript" type="text/javascript"> <!-- x=50; //number of times to repeat for (i=0; i<x; i++){ document.write("Put Text here<br>"); } //--> </script>
If I understand right... this should do the trick. <script language="javascript"> function repeatText( r, w, t) { var reps = document.getElementById(r).value; var where = document.getElementById(w); var text = document.getElementById(t).value; where.innerHTML = ''; for ( var x=0; x<reps; x++ ) where.innerHTML += text + "<br>"; } </script> Repeat how many times? <input type="text" name="repnum" id="repnum" /><br /> What to repeat? <input type="text" name="inputtext" id="inputtext" /><br /> <input type="button" value="repeat" onclick="repeatText('repnum','spithere','inputtext')" /> <br /><br /> <div name="spithere" id="spithere"></div> Code (markup):