最新更新 sitemap 网站制作设计本站搜索
网页设计
国外网站 韩国网站 个人主页 手提袋设计 CSS 网页特效 平面设计 网站设计 Flash CMS技巧 服装网站 php教程 photoshop 画册 服务器选用 数据库 Office
虚拟主机 域名注册 云主机 网页设计 客服QQ:8208442
当前位置:首页 > 网页JS特效 > 文本特效类

网页特效:公告栏

日期:09-07    来源:中国设计秀    作者:cnwebshow.com

下面为效果显示区

mWN中国设计秀

脚本说明:mWN中国设计秀
第一步:把如下代码加入<head>区域中mWN中国设计秀
<script language="JavaScript">mWN中国设计秀
<!-- Activate Cloaking DevicemWN中国设计秀

mWN中国设计秀
var i = 0; mWN中国设计秀
// used to cycle thru messages mWN中国设计秀
var TextNumber = -1;mWN中国设计秀
// array of messages mWN中国设计秀
var TextInput = new Object();mWN中国设计秀
// used to load manipulate message mWN中国设计秀
var HelpText=""; mWN中国设计秀
// used to load messagemWN中国设计秀
var Text = ""; mWN中国设计秀
// length of timeout (smaller is faster) mWN中国设计秀
var Speed=50;mWN中国设计秀
// used to display message numbermWN中国设计秀
var message=0;mWN中国设计秀
// used to position text in ver 2.0mWN中国设计秀
var addPadding="rn";mWN中国设计秀

// Each element of TextInput represents a single message.mWN中国设计秀
TextInput[0] = "今天注意了有新的任务布置"; mWN中国设计秀
TextInput[1] = "欢迎你的光临!本站为你提供大量javascript下载";mWN中国设计秀
TextInput[2] = "重点介绍Javascript";mWN中国设计秀
TextInput[3] = "与制作网页特效密切相关的技术";mWN中国设计秀
TextInput[4] = "本站同时有影音空间等栏目";mWN中国设计秀
TextInput[5] = "还有新闻及健康方面的资料";mWN中国设计秀
TextInput[6] = "还有宽带网方面的大量技术文章";mWN中国设计秀
TextInput[7] = "本站网址:http://www.cnwebshow.com";mWN中国设计秀

TotalTextInput = 7; // (0, 1, 2, 3, 4, 5, 6, 7)mWN中国设计秀

// Positioning and speed vary between versions.mWN中国设计秀
var Version = navigator.appVersion; mWN中国设计秀
if (Version.substring(0, 1)==3)mWN中国设计秀
{mWN中国设计秀
Speed=200;mWN中国设计秀
addPadding="";mWN中国设计秀
}mWN中国设计秀

for (var addPause = 0; addPause <= TotalTextInput; addPause++) mWN中国设计秀
{TextInput[addPause]=addPadding+TextInput[addPause];}mWN中国设计秀
var TimerIdmWN中国设计秀
var TimerSet=false;mWN中国设计秀

// Called by >>> button (display next message) .mWN中国设计秀
function nextMessage() mWN中国设计秀
{mWN中国设计秀
if (!TimerSet)mWN中国设计秀
{mWN中国设计秀
TimerSet=true;mWN中国设计秀
clearTimeout (TimerId);mWN中国设计秀
if (TextNumber>=TotalTextInput)mWN中国设计秀
{ mWN中国设计秀
alert("This is the end of the list!");mWN中国设计秀
TimerSet=false;mWN中国设计秀
}mWN中国设计秀
elsemWN中国设计秀
{mWN中国设计秀
TextNumber+=1;mWN中国设计秀
message=TextNumber+1;mWN中国设计秀
document.forms[0].elements[2].value= message;mWN中国设计秀
Text = TextInput[TextNumber];mWN中国设计秀
HelpText = Text;mWN中国设计秀
}mWN中国设计秀
teletype();mWN中国设计秀
}mWN中国设计秀
}mWN中国设计秀

// Gets and displays character from rollMessage() . mWN中国设计秀
// Variable Speed controls length of timeout and thus the speed of typing.mWN中国设计秀
function teletype() mWN中国设计秀
{mWN中国设计秀
if (TimerSet)mWN中国设计秀
{mWN中国设计秀
Text=rollMessage();mWN中国设计秀
TimerId = setTimeout("teletype()", Speed);mWN中国设计秀
document.forms[0].elements[0].value=Text;mWN中国设计秀
}mWN中国设计秀
}mWN中国设计秀

// Pulls one character at a time from string and returns (as Text) to function teletype() for displaying.mWN中国设计秀
function rollMessage () mWN中国设计秀
{mWN中国设计秀
i++;mWN中国设计秀
var CheckSpace = HelpText.substring(i-1, i);mWN中国设计秀
CheckSpace = "" + CheckSpace;mWN中国设计秀
if (CheckSpace == " ") mWN中国设计秀
{i++;}mWN中国设计秀
if (i >= HelpText.length+1) mWN中国设计秀
{mWN中国设计秀
TimerSet=false;mWN中国设计秀
Text = HelpText.substring(0, i);mWN中国设计秀
i=0; mWN中国设计秀
return (Text);mWN中国设计秀
}mWN中国设计秀
Text = HelpText.substring(0, i);mWN中国设计秀
return (Text);mWN中国设计秀
}mWN中国设计秀
// Initially called by onLoad in BODY tag to load title. mWN中国设计秀
function initTeleType() mWN中国设计秀
{mWN中国设计秀
Text="rn Manual Tele-Type Display";mWN中国设计秀
document.forms[0].elements[0].value=Text;mWN中国设计秀
}mWN中国设计秀
// Called by <<< button (get previous message).mWN中国设计秀
function lastMessage() mWN中国设计秀
{mWN中国设计秀
if (!TimerSet && TextNumber!=-1)mWN中国设计秀
{mWN中国设计秀
TimerSet=true;mWN中国设计秀
clearTimeout (TimerId);mWN中国设计秀
if (TextNumber<=0)mWN中国设计秀
{ mWN中国设计秀
alert("This is the beginning of the list!");mWN中国设计秀
TimerSet=false;mWN中国设计秀
}mWN中国设计秀
else mWN中国设计秀
{mWN中国设计秀
TextNumber-=1;mWN中国设计秀
message=TextNumber+1;mWN中国设计秀
document.forms[0].elements[2].value= message;mWN中国设计秀
Text = TextInput[TextNumber];mWN中国设计秀
HelpText = Text;mWN中国设计秀
} mWN中国设计秀
teletype(); mWN中国设计秀
}mWN中国设计秀
}mWN中国设计秀

// Deactivate Cloaking --></script>mWN中国设计秀

mWN中国设计秀
第二步:在<body>区域中加入如下代码:mWN中国设计秀
<form>mWN中国设计秀
<table CELLSPACING="0" CELLPADDING="0" WIDTH="17%">mWN中国设计秀
<tr>mWN中国设计秀
<td width="100%" colspan="3" valign="top"><div align="center"><p><textarea NAME="teletype" ROWS="3" COLS="28" wrap="yes"></textarea> </td>mWN中国设计秀
</tr>mWN中国设计秀
<tr align="center">mWN中国设计秀
<td width="40%" valign="top" bgcolor="#0000A0"><input TYPE="button" VALUE="公告栏" onClick="lastMessage()"></td>mWN中国设计秀
<td width="30%" bgcolor="#0000A0" valign="top"><input TYPE="text" value="共8条" SIZE="5" name="1"></td>mWN中国设计秀
<td width="30%" bgcolor="#0000A0" valign="top"><input TYPE="button" VALUE="阅 读" onClick="nextMessage()"></td>mWN中国设计秀
</tr>mWN中国设计秀
</table>mWN中国设计秀
</form>mWN中国设计秀

mWN中国设计秀
mWN中国设计秀
 mWN中国设计秀

本文引用地址:/js/article_61609.html
网站地图 | 关于我们 | 联系我们 | 网站建设 | 广告服务 | 版权声明 | 免责声明