»
Tiếng AnhTiếng PhápTiếng Việt

In - Chữ xuất hiện trong khung - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Biểu mẫu » Vùng nhập liệu » Chữ xuất hiện trong khung
URL: https://www.javascriptbank.com/crazy-text-animator.html

Chữ xuất hiện trong khung © JavaScriptBank.comHiệu ứng làm cho chữ xuất hiện trong khung theo bốn cách khác nhau.

Phiên bản đầy đủ: jsB@nk » Biểu mẫu » Vùng nhập liệu » Chữ xuất hiện trong khung
URL: https://www.javascriptbank.com/crazy-text-animator.html



JavaScript
<script language="javascript"><!--hide/********************************************Program:Crazy Text AnimatorAuthor:Blake Birkenfeld © 1998Contact Info:   [email protected][email protected]/Colosseum/Stadium/6783/Functions:Type, Stay, Stay2, Close,Erase, Doors, Blink, ScrollBlink2Description:A text animator that shows4 messages in various ways.Notes:This program is free for useas long as this comment is left in place.Use:Make sure you include a formnamed "form1" with a textinput named "text" in the body of your page.  Change the size of the text input so that it is large enough to hold any of your messages.  Also put Type() in the onLoad tag of the body.********************************************///Change the following 4 messages to your liking.var txt = "Crazy Text Animator"var txt2 = "Blake Birkenfeld"var txt3 = "[email protected]"var txt4 = "Cool Way to Show 4 Messages"//Make sure that "def" is longer than your longest messagevar def = "_______________________________________"  //Don't change any of the followingvar end = txt4.lengthvar end2 = end / 2var close = end2var close2 = end2var close3 = endvar max2 = txt3.lengthvar mid = max2 / 2var max = txt2.lengthvar msgvar msg2var msg3var msg4var msg5var msg6var word = 0var word2 = txt.lengthvar scroll = 0var door = maxvar blink = 0var blink2 = 20var stay = 0var timestayvar timevar time2var doortimevar timeblinkvar timescrollvar timeblink2var timeclosefunction Type() {if (word <= txt.length) { word++;msg = txt.substring(0, word);document.form1.text.value = msgtime = setTimeout("Type()", 100) }else { word = 0;clearTimeout(time);Stay() }}function Stay() {if (stay==0) { document.form1.text.value = txt;stay = 1;timestay = setTimeout("Stay()", 1000) }else if (stay==1) { document.form1.text.value = txt;stay = 0;clearTimeout(timestay);Erase() }}function Close() {if(close2 <= end) {close -= 1;close2++;close3 -= 2;msg6 = txt4.substring(close, end2) + def.substring(0, close3) + txt4.substring(end2, close2);document.form1.text.value = msg6;timeclose = setTimeout("Close()", 100)}else { clearTimeout(timeclose);close = end2;close2 = end2;close3 = end;Stay2()}}function Stay2() {if (stay==0) { document.form1.text.value = txt4;stay = 1;timestay = setTimeout("Stay2()", 1300) }else if (stay==1) { document.form1.text.value = txt4;stay = 0;clearTimeout(timestay);Doors() }}function Erase() {if (word2 <= txt.length && word2 > 0) { word2 -= 1;msg2 = txt.substring(0, word2)document.form1.text.value = msg2time2 = setTimeout("Erase()", 20)}else  { word2 = txt.length;clearTimeout(time2);Close() }}function Doors() {if (door >= 0) {door -= 1;msg3 = txt2.substring(door, max) document.form1.text.value = msg3doortime = setTimeout("Doors()", 100)}else { door = max;clearTimeout(doortime);Blink() }}function Blink() {if (blink==0) { document.form1.text.value = txt2;blink = 1;timeblink = setTimeout("Blink()", 200) }else if (blink==1) { document.form1.text.value = "";blink = 2 ;timeblink = setTimeout("Blink()", 200) }else if (blink==2) { document.form1.text.value = txt2;blink = 3;timeblink = setTimeout("Blink()", 200) }else if (blink==3) { document.form1.text.value = "";blink = 4;timeblink = setTimeout("Blink()", 200) }else if (blink==4) { document.form1.text.value = txt2;blink = 5;timeblink = setTimeout("Blink()", 200) }else if (blink==5) { document.form1.text.value = "";blink = 0;clearTimeout(timeblink);Scroll() }}function Scroll() {if(scroll <= txt2.length) { msg4 = txt2.substring(scroll, txt2.length);document.form1.text.value = msg4;scroll++;timescroll = setTimeout("Scroll()", 100)}else { clearTimeout(timescroll);scroll = 0Blink2() }}function Blink2() {if (blink2==20) { msg5 = txt3;document.form1.text.value = msg5;blink2 = 0;timeblink2 = setTimeout("Blink2()", 800) }else if (blink2==0) { msg5 = txt3.substring(0, mid) + def.substring(0, mid);document.form1.text.value = msg5;blink2 = 1;timeblink2 = setTimeout("Blink2()", 300) }else if (blink2==1) { msg5 = def.substring(0, mid) + txt3.substring(mid, max2);document.form1.text.value = msg5;blink2 = 2 ;timeblink2 = setTimeout("Blink2()", 300) }else if (blink2==2) { msg5 = txt3.substring(0, mid) + def.substring(0, mid);document.form1.text.value = msg5;blink2 = 3;timeblink2 = setTimeout("Blink2()", 300) }else if (blink2==3) { msg5 = def.substring(0, mid) + txt3.substring(mid, max2);document.form1.text.value =msg5;blink2 = 4;timeblink2 = setTimeout("Blink2()", 300) }else if (blink2==4) { msg5 = txt3.substring(0, mid) + def.substring(0, mid);document.form1.text.value = msg5;blink2 = 5;timeblink2 = setTimeout("Blink2()", 300) }else if (blink2==5) { msg5 = def.substring(0, mid) + txt3.substring(mid, max2);document.form1.text.value = msg5;blink2 = 6;timeblink2 = setTimeout("Blink2()", 300) }else if (blink2==6) { document.form1.text.value = txt3;blink2 = 20;clearTimeout(timeblink2);Type() }}//--></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<body onload="Type()"><form name="form1"><input type="text" name="text" size="32"></form></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->