Ejemplos en Javascript

Letras dinámicas

Animación creada convirtiendo en mayúscula una letra a la vez.

<HTML>
<HEAD>

<TITLE>Ejemplos Javascript: ejemplo prÃ?Æ?Ã?¡ctico </TITLE>

<script lanuage="JavaScript">

// This script was written by Nathan Wenneker
// naw@3eagles.com
// http://www.geocities.com/SiliconValley/Pines/7183
// http://www.geocities.com/SiliconValley/Lakes/3595


// This script is free to use as long as you keep
// these comments with it.

// This script will go through a message one character at a
// time and change the caps of that character. It
// looks neat but if in a non fixed type font, it will
// lose some of the effect.  Set "speedtogo" higher to
// go slower and lower to go faster. Set a[1] and a[2]
// to the sets of alternating caps you want.  I have
// chosen a[1] to be all small and a[2] to be all big
// but you can set then to anything.  Just make sure
// you have them reversed in the a[2] or you will
// lose effect.


// Enjoy.

var count = -1;
var counter;
var nchar
var speedtogo = 200

var a = new Array();

a[1] = "Mensaje 1";
a[2] = "Mensaje 2";


function capswitch() {
 count++
 if(count == 0){
   document.wow.display.value = a[1]
  }
 if(count == 1){
    document.wow.display.value = a[2].substring(0, 1) +
a[1].substring(20, 1)
        }
 if(count > 1){
   a[3] = a[1].substring(0, count - 1) + a[2].substring(count - 1,
count) + a[1].substring(20, count)
  document.wow.display.value = a[3]
 }
 if(count == a[1].length){
    count = -1
  }

         counter    = setTimeout("capswitch()",speedtogo);

 }
</script>


</HEAD>

<BODY bgcolor="white" onload="capswitch()">

<center>
<form name="wow">

<input type="text" size="18" name="display" value="">

</form>
</center>


</body>
</html>
 

Animaci?exto