可以文本显示的公告栏的js代码_典型特效

WBOY
リリース: 2016-05-16 19:17:01
オリジナル
1891 人が閲覧しました

一个可以文本显示的公告栏,可以在多处使用,绝对不可错过! 
脚本说明: 
第一步:把如下代码加入

区域中 
<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> 
第二步:在区域中加入如下代码: 
 
 
 
 
 
 
 
 
 
 

 

 
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!