Ejemplos en Javascript

Mensajes textuales dentro de un banner

Distintos mensajes en un campo text de formulario que aparecen a intervalos de tiempo

<HTML>
<HEAD>

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

<script language="JavaScript">
<!--- hide script from old browsers                   
        var CurrentMsg = 'hello ';                   
function update(msg) {                           
        var pad_str="";                           
        n = msg.length;                           
        if(n<72) {                                   
                pad = (73-n)/2;                                   
                for(var i=0; i<pad; i++) {                                           
                        pad_str+=" ";                       
                }                       
        }                         
        CurrentMsg = pad_str + msg;                           
        document.messages.field.value = CurrentMsg;                           clearTimeout(timer);                           
        timer = setTimeout("idleMsg()",1500);       
}                           

function MakeArray(n) {                           
        this.length=n;                           
        for(var i = 1; i<= n; i++) {                                   
                this[i] = "";               
        }                           
        return(this);       
        }               
        var index = 1;           
        var notice_num = 9;                   
        var notices = new MakeArray(notice_num);       
        notices[1] = "Mensaje 1";       
        notices[2] = "Mensaje 2";
        notices[3] = "Mensaje 3";       
        notices[4] = "Mensaje 4";
        notices[5] = "Mensaje 5";
        notices[6] = "Mensaje 6";
        notices[7] = "Mensaje 7";       
        notices[8] = "Mensaje 8";                   
        var timer = setTimeout('idleMsg()',1500);                   

function nochange() {                           
        document.messages.field.value = CurrentMsg;       
}                   

function idleMsg() {                           
        update(notices[index++]);                           
        if(index>

notice_num) {
                index=1;
        } 
}

// end hiding from old browsers-->                 
</script>


</HEAD>

<BODY bgcolor="white">

<form name="messages" onSubmit="return false">
<input type="text" name="field" size=73 value="   Hi" onFocus="self.status='This is a JavaScript information data field'; return true" onChange="nochange()">
</form>


</body>
</html>

Animaci?exto