
05/05/2009, 11:48
|
 | | | Fecha de Ingreso: abril-2009
Mensajes: 110
Antigüedad: 15 años, 10 meses Puntos: 5 | |
Respuesta: ¿window.setTimeout dentro de un while? <head>
<meta name="author" content="alor86" />
<script type="text/javaScript">
var a=2;
var intervalo;
function restar(){
intervalo=setInterval(res,2000);
}
function res(){
if(a>=0){
var r = document.getElementById('r');
a-=Math.random();
r.innerHTML+="valor de a es==>"+a+"<br/>";
}
else{
clearInterval(intervalo);
}
}
</script>
<title>resta</title>
</head>
<body onload="restar();">
<div id="r">
</div>
</body>
</html>
prueba asi |