Home  >  Article  >  Web Front-end  >  js code for bulletin board that can display text_Typical special effects

js code for bulletin board that can display text_Typical special effects

WBOY
WBOYOriginal
2016-05-16 19:17:011931browse

A bulletin board that can display text and can be used in many places. It is definitely not to be missed!
Script description:
Step 1: Add the following code to the

area

Step 2: Add the following code to the
area:

 
 
 
 
 
 
 
 
 

 


<script> <BR><!-- Activate Cloaking Device <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>// 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>TotalTextInput = 7; // (0, 1, 2, 3, 4, 5, 6, 7) <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>for (var addPause = 0; addPause <= TotalTextInput; addPause++) <BR>{TextInput[addPause]=addPadding+TextInput[addPause];} <BR>var TimerId <BR>var TimerSet=false; <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>// 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>// 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>// Deactivate Cloaking --></script>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn