Случайно число : Проблем

vik96

Registered
Здравейте. Защо този код :

Код:
<form name="f"><input type="text" name="text"></form>
<script>
SetTimeOut("rando()",250);

function rando()
{
document.f.text.value = Math.floor(Math.random()*10);
SetTimeOut("rando()",250);
}
</script>
не работи ?
 
Пробвай с този код:
Код:
<html>
<head>
<script type="text/javascript">
function rando()
{
var pole = document.getElementById('myPole');
pole.value = Math.floor(Math.random()*10);
SetTimeOut("rando()",250);
}
</script>
</head>
<body onload="rando();">
<form name="f"><input type="text" id="myPole" name="text"></form>
</body>
</html>
 
това ми трябваше:
Код:
<input type="text" id="text" value="9">
<script>
setTimeout("round()",25);
function round()
{
document.getElementById('text').value = Math.floor(Math.random()*10);
setTimeout("round()",25);
}
</script>
 

Back
Горе