Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/12/2008, 15:08
Slayer_sephiroth
 
Fecha de Ingreso: enero-2008
Mensajes: 111
Antigüedad: 16 años, 3 meses
Puntos: 0
Funcion para parrar y arrancar en un boton

Hola, tengo este codigo que os muestro, lo que quiero hacer es que al dar al boton me pare y cuando vuelva a dar me arranque. Nose que tipo de funcion podria crear. Alguien tiene una idea??


<html><head>
<title>Texto en la barra de estado</title>
<script language="javascript">

var textoabajo = " Hola";
var posicion = 0;
var parar=true;


function movertexto(){
if (posicion < textoabajo.length)
posicion ++;
else
posicion = 1;
string_actual = textoabajo.substr(posicion) + textoabajo.substr(0,posicion)
window.status = string_actual
setTimeout("movertexto()",150)
}

function caja(){
textoabajo=document.form1.campotxt.value;
parar=!parar;
if (parar)
window.setTimeout('movertexto()',1000);
}


</script>
<style type="text/css">
<!--
.Estilo1 {
font-size: 18pt;
font-weight: bold;
}
-->
</style>
</head>

<body onLoad="movertexto();">


<p align="center" class="Estilo1">
<p>&nbsp;</p>
<form name="form1" method="post" action="">
<label>
<input name="campotxt" type="text" id="campotxt">
</label>
<label>
<input type="button" name="button" value="Arrancar/Parar" onClick="caja();" >
</label>
</form>
<p>&nbsp;</p>
</body>
</html>