You cannot use document.write to change a page once it has been loaded.
Doing so, or at least trying, causes the program to reset and start over.
For proof, try this variation:
Code:
<html>
<head>
<title>Test</title>
<script type="text/javascript">
// For: http://www.webdeveloper.com/forum/showthread.php?t=209152
function loop() {
var i=document.getElementById('T1').value*1;
var g=document.getElementById('T2').value*1;
var str = '';
for (var x=i; x<=g; x++) { str += x+'<br>'; }
document.getElementById('divStr').innerHTML = str;
}
</script>
<body>
<label> <input name="T1" type="text" id="T1" /> </label>
<label> <input name="T2" type="text" id="T2" /> </label>
<input type="button" value="Click me!" onclick="loop()" />
<div id="divStr"></div>
</body>
</html>
Plus you had some invalid syntax.
Check the error console in FF with you code for some clues.
Bookmarks