一个可以文本显示的公告栏,可以在多处使用,绝对不可错过! 脚本说明: 第一步:把如下代码加入区域中 <br> <!-- Activate Cloaking Device <br> <br> <br> var i = 0; <br> // used to cycle thru messages <br> var TextNumber = -1; <br> // array of messages <br> var TextInput = new Object(); <br> // used to load manipulate message <br> var HelpText=""; <br> // used to load message <br> var Text = ""; <br> // length of timeout (smaller is faster) <br> var Speed=50; <br> // used to display message number <br> var message=0; <br> // used to position text in ver 2.0 <br> var addPadding="rn"; <br> <br> // Each element of TextInput represents a single message. <br> TextInput[0] = "今天注意了有新的任务布置"; <br> TextInput[1] = "欢迎你的光临!本站为你提供大量javascript下载"; <br> TextInput[2] = "重点介绍Javascript"; <br> TextInput[3] = "与制作网页特效密切相关的技术"; <br> TextInput[4] = "本站同时有影音空间等栏目"; <br> TextInput[5] = "还有新闻及健康方面的资料"; <br> TextInput[6] = "还有宽带网方面的大量技术文章"; <br> TextInput[7] = "本站网址:http://www.njcatv.net"; <br> <br> TotalTextInput = 7; // (0, 1, 2, 3, 4, 5, 6, 7) <br> <br> // Positioning and speed vary between versions. <br> var Version = navigator.appVersion; <br> if (Version.substring(0, 1)==3) <br> { <br> Speed=200; <br> addPadding=""; <br> } <br> <br> for (var addPause = 0; addPause <= TotalTextInput; addPause ) <br> {TextInput[addPause]=addPadding TextInput[addPause];} <br> var TimerId <br> var TimerSet=false; <br> <br> // Called by >>> button (display next message) . <br> function nextMessage() <br> { <br> if (!TimerSet) <br> { <br> TimerSet=true; <br> clearTimeout (TimerId); <br> if (TextNumber>=TotalTextInput) <br> { <br> alert("This is the end of the list!"); <br> TimerSet=false; <br> } <br> else <br> { <br> TextNumber =1; <br> message=TextNumber 1; <br> document.forms[0].elements[2].value= message; <br> Text = TextInput[TextNumber]; <br> HelpText = Text; <br> } <br> teletype(); <br> } <br> } <br> <br> // Gets and displays character from rollMessage() . <br> // Variable Speed controls length of timeout and thus the speed of typing. <br> function teletype() <br> { <br> if (TimerSet) <br> { <br> Text=rollMessage(); <br> TimerId = setTimeout("teletype()", Speed); <br> document.forms[0].elements[0].value=Text; <br> } <br> } <br> <br> // Pulls one character at a time from string and returns (as Text) to function teletype() for displaying. <br> function rollMessage () <br> { <br> i ; <br> var CheckSpace = HelpText.substring(i-1, i); <br> CheckSpace = "" CheckSpace; <br> if (CheckSpace == " ") <br> {i ;} <br> if (i >= HelpText.length 1) <br> { <br> TimerSet=false; <br> Text = HelpText.substring(0, i); <br> i=0; <br> return (Text); <br> } <br> Text = HelpText.substring(0, i); <br> return (Text); <br> } <br> // Initially called by onLoad in BODY tag to load title. <br> function initTeleType() <br> { <br> Text="rn Manual Tele-Type Display"; <br> document.forms[0].elements[0].value=Text; <br> } <br> // Called by <<< button (get previous message). <br> function lastMessage() <br> { <br> if (!TimerSet && TextNumber!=-1) <br> { <br> TimerSet=true; <br> clearTimeout (TimerId); <br> if (TextNumber<=0) <br> { <br> alert("This is the beginning of the list!"); <br> TimerSet=false; <br> } <br> else <br> { <br> TextNumber-=1; <br> message=TextNumber 1; <br> document.forms[0].elements[2].value= message; <br> Text = TextInput[TextNumber]; <br> HelpText = Text; <br> } <br> teletype(); <br> } <br> } <br> <br> // Deactivate Cloaking --> 第二步:在区域中加入如下代码: