Ejemplos en Javascript
Mensajes tipo máquina de escribir
Mensaje que va apareciendo como si saliera de una máquina de escribir (un carácter a la vez) dentro de un campo texto de form. Hay dos botones para controlar la dirección y velocidad del texto.
<HTML>
<HEAD>
<TITLE>Ejemplos Javascript: ejemplo prÃ?Æ?Ã?¡ctico </TITLE>
<SCRIPT>
<!--- Hide script from old browsers
var msg = "it even re-sizes itself to fit your message!"
var x = ""
num = 1
toggle = 1
tt = 1
OOK = 0
timval = 60
var tval = ""
function switcha() {
if (document.myform.dowhat.value == "Start/Stop" )
tval = "Forward/Backward"
if (document.myform.dowhat.value == "Forward/Backward")
tval = "Fast/Slow"
if (document.myform.dowhat.value == "Fast/Slow")
tval = "Start/Stop"
document.myform.dowhat.value = tval
}
function switcha2() {
if (document.myform.dowhat.value == "Start/Stop" ) toggla()
if (document.myform.dowhat.value == "Forward/Backward" ) csd()
if (document.myform.dowhat.value == "Fast/Slow" ) fasl()
}
function fasl() { timval = (timval==60 ? 150 : 60 ) }
function csd() {
tt = ( tt==1 ? 0 : 1)
}
function scroll() {
if (tt==1)
if (num <= msg.length)
OOK = 1
if (tt==0)
if (num >
= 0)
OOK = 1
if ( OOK == 1)
{
OOK = 0
x = msg.substring(0,num)
document.myform.scroll.value = x
num = ( tt==1 ? num+1 : num-1 )
}
else
{
x = ""
document.myform.scroll.value = ""
num = (tt==1 ? 0 : msg.length )
}
if (toggle == 1)
setTimeout("scroll()", timval)
}
function toggla() {
toggle = (toggle == 1 ? 0 : 1 )
if (toggle == 1) scroll()
}
// end hiding from old browsers -->
</SCRIPT>
</HEAD>
<BODY bgcolor="white" onLoad="scroll()">
<FORM NAME="myform">
<INPUT TYPE="text" NAME="scroll" SIZE=&{msg.length + 2}; >
<BR><BR>
<INPUT TYPE="button" VALUE="Do It" onClick="switcha2()">
<INPUT TYPE="text" NAME="dowhat" SIZE = 10 VALUE = "Start/Stop">
<INPUT TYPE="button" VALUE="next" onClick="switcha()" >
</FORM>
</body>
</html>
<HEAD>
<TITLE>Ejemplos Javascript: ejemplo prÃ?Æ?Ã?¡ctico </TITLE>
<SCRIPT>
<!--- Hide script from old browsers
var msg = "it even re-sizes itself to fit your message!"
var x = ""
num = 1
toggle = 1
tt = 1
OOK = 0
timval = 60
var tval = ""
function switcha() {
if (document.myform.dowhat.value == "Start/Stop" )
tval = "Forward/Backward"
if (document.myform.dowhat.value == "Forward/Backward")
tval = "Fast/Slow"
if (document.myform.dowhat.value == "Fast/Slow")
tval = "Start/Stop"
document.myform.dowhat.value = tval
}
function switcha2() {
if (document.myform.dowhat.value == "Start/Stop" ) toggla()
if (document.myform.dowhat.value == "Forward/Backward" ) csd()
if (document.myform.dowhat.value == "Fast/Slow" ) fasl()
}
function fasl() { timval = (timval==60 ? 150 : 60 ) }
function csd() {
tt = ( tt==1 ? 0 : 1)
}
function scroll() {
if (tt==1)
if (num <= msg.length)
OOK = 1
if (tt==0)
if (num >
= 0)
OOK = 1
if ( OOK == 1)
{
OOK = 0
x = msg.substring(0,num)
document.myform.scroll.value = x
num = ( tt==1 ? num+1 : num-1 )
}
else
{
x = ""
document.myform.scroll.value = ""
num = (tt==1 ? 0 : msg.length )
}
if (toggle == 1)
setTimeout("scroll()", timval)
}
function toggla() {
toggle = (toggle == 1 ? 0 : 1 )
if (toggle == 1) scroll()
}
// end hiding from old browsers -->
</SCRIPT>
</HEAD>
<BODY bgcolor="white" onLoad="scroll()">
<FORM NAME="myform">
<INPUT TYPE="text" NAME="scroll" SIZE=&{msg.length + 2}; >
<BR><BR>
<INPUT TYPE="button" VALUE="Do It" onClick="switcha2()">
<INPUT TYPE="text" NAME="dowhat" SIZE = 10 VALUE = "Start/Stop">
<INPUT TYPE="button" VALUE="next" onClick="switcha()" >
</FORM>
</body>
</html>
Animaci?exto
- Insertar banner
- Mensaje typer de formulario
- Mensaje desde campo Textarea
- Mensajes tipo máquina de escribir
- Máquina de escribir
- Animación de texto en un campo text
- Letras dinámicas
- Texto animado con un pequeño editor
- Mensajes textuales dentro de un banner
- Eco
- Textbox Bounce
- Texto animado que se desliza
- Efecto "drip"
- Efecto Zipper
- Efecto "falling"
- Transferidor de texto
- Transferidor de texto, sin botón