📄 505.html
字号:
<STYLE type=text/css>
<!--
body,td { font-size:9pt;}
hr { color: #000000; height: 1px}
-->
</STYLE>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD><TITLE>论坛精华 >> javascript小栈 >> JavaScript让网页的状态栏变得有些不一样</title>
</head>
<body >
<p><IMG SRC="../image/jsp001_middle_logo.gif" WIDTH="180" HEIGHT="60" BORDER=0 ALT=""></p>
<table width=100% bgcolor="#cccccc" align=center cellpadding="2" cellspacing="0" border=1 bordercolorlight="#000000" bordercolordark="#FFFFFF">
<tr bgcolor="#EFF8FF"><td>
<a href=http://www.jsp001.com/list_thread.php?int_attribute=4>论坛精华</a>
>> <a href=http://www.jsp001.com/list_thread.php?forumid=46&int_attribute=4>javascript小栈</a>
>> JavaScript让网页的状态栏变得有些不一样 [<a href=http://www.jsp001.com/forum/showthread.php?goto=newpost&threadid=505>查看别人的评论</a>]<br>
<hr><p>由 amtd 发布于: 2001-02-20 09:26</p><p><img src="images/icons/icon1.gif" alt="Post" border=0> </p><p>JavaScript让网页的状态栏变得有些不一样<br>(作者:廖年旺 2000年11月08日 16:49)<br><br> 在遨游网海的途程中,我们经常发现在打开一些网页的时候,浏览器的状态栏上就会出现各种形式的文本提示,而且提示是动态的,有的眨眼、有的冒泡、还有的排列出现。这种提示不影响浏览的速度,又不影响观看网页,因为它不占据页面的部分,所以很多的主页都应用这种特效。 <br><br> 您是否也想在自己的网页中拥有这样的动态状态栏呢?不要急,要实现这样的特效并不很难。 <br><br> 下面笔者将逐一介绍这三种动态状态栏。 <br><br>眨眼式 <br> 说明:在浏览器打开网页的时候,下面的状态栏就会像眨眼睛似地出现文本提示信息。 <br><br> 〈body〉 <br><br> 〈table〉 <br><br> 〈td align="center"〉〈script language="JavaScript"〉 <br><br> 〈!-- <br><br> var yourwords="欢迎光临"; <br><br> var speed=1000; <br><br> var control=1 <br><br> function flash() <br><br> { <br><br> if(control = 1) <br><br> {window.status=yourwords; <br><br> control=0 <br><br> } <br><br> else <br><br> { <br><br> window.status=""; <br><br> control=1; <br><br> } <br><br> setTimeout("flash();",speed); <br><br> } <br><br> flash(); <br><br> 〈/script〉〈/td〉 <br><br> 〈/body〉 <br><br>冒泡式 <br> 说明:在浏览器打开网页的时候,状态栏里的文本就像是冒泡一样,一个字一个字地出现。 <br><br> 〈body〉 <br><br> 〈table〉 <br><br> 〈td align="center"〉〈script language="JavaScript"〉 <br><br> 〈!-- <br><br> var msg="欢迎光临"; <br><br> var interval=300 <br><br> var spacelen=120 <br><br> var space10=""; <br><br> var seq=0; <br><br> function Scroll() <br><br> { <br><br> len=msg.length; <br><br> window.status=msg.substring(0,seq+1); <br><br> seq++; <br><br> if (seq〉=len){ <br><br> seq=0; <br><br> window.status=''; <br><br> window.setTimeout("Scroll();",interval); <br><br> } <br><br> else <br><br> window.setTimeout("Scroll();",interval); <br><br> } <br><br> Scroll(); <br><br> 〈/Script〉〈/td〉 <br><br> 〈/body〉 <br><br>排列式 <br> 说明:在浏览器打开网页的时候,状态栏显示的文本文字排列出现。 <br><br> 〈html〉 <br><br> 〈head〉 <br><br> 〈title〉status bar〈/title〉 <br><br> 〈/head〉 <br><br> 〈script language="javaScript"〉 <br><br> 〈!-- <br><br> //创建一个自定义的对象类型 <br><br> function statusMessageObject(m,p,d){ <br><br> this.msg=m <br><br> this.out="" <br><br> this.pos=p <br><br> this.delay=d <br><br> this.i =0 <br><br> this.reset=clearMessage <br><br> } <br><br> //清除状态栏信息的函数 <br><br> function clearMessage(){ <br><br> this.pos=POSITION <br><br> } <br><br> //初始化位置,延迟和状态栏信息 <br><br> var POSITION=100 <br><br> var DELAY=5 <br><br> var MESSAGE="欢迎你!" <br><br> //创建statusMessageObject的实例 <br><br> var scroll =new statusMessageObject(MESSAGE,POSITION,DELAY) <br><br> //字符滚动变幻的主函数 <br><br> function change(jumpSpaces,position){ <br><br> var msg=scroll.msg <br><br> var out="" <br><br> //下面的程序主要靠控制空格的个数来实现字符的移动 <br><br> for(var i=0;i〈position;i++) <br><br> {out+=msg.charAt(i)} <br><br> for(i=1;i〈jumpSpaces;i++) <br><br> {out+=""} <br><br> out+=msg.charAt(position) <br><br> window.status=out <br><br> if(jumpSpaces〈=1){ <br><br> position++ <br><br> if(msg.charAt(position)=='') <br><br> {position++} <br><br> jumpsSpaces=100-position <br><br> } else if(jumpSpaces〉3) <br><br> {jumpSpaces*=.75} <br><br> else <br><br> {jumpSpaces--} <br><br> //如果信息滚动完毕则重新执行一遍 <br><br> if(position!=msg.length){ <br><br> var cmd="change("+jumpSpaces+","+position+")"; <br><br> scro11ID=window.setTimeout(cmd,scroll.delay); <br><br> }else{ <br><br> //使所有信息重新复位 <br><br> window.status="" <br><br> jumpSpaces=0 <br><br> position=0 <br><br> cmd="change("+jumpSpaces+","+position+")"; <br><br> scro11ID=window.setTimeout(cmd,scroll.delay); <br><br> return false <br><br> } <br><br> return true <br><br> } <br><br> //--〉 <br><br> 〈/script〉 <br><br> 〈BODY BACKGROUND="temp.jpg" ONLOAD="change(100,0)"〉 <br><br> 〈/BODY〉 <br><br> 〈/HTML〉 <br><br> 注意,第三种方法中使用的“temp.jpg”图像文件可以随自己喜好选择一幅。 <br><br> 只要将以上三种的其中一种代码放到你的主页,就可以实现动态状态栏了。以上三种动态状态栏的提示内容都可以根据自己喜好自行修改。通过上面几个简单的特效实例,你自己也可以设计出更多这样的特效形式状态栏,形成您自己的特殊风格。<br>__________________<br><font color=red>真实源于生活! </font><br>请访问我们的网站: <br>(VB爱好者乐园) <br><a href="http://www.vbgood.com" target=_blank>http://www.vbgood.com</a><br><a href="http://www.d1vb.com" target=_blank>http://www.d1vb.com</a><br><a href="http://61.128.97.225/vbgood/index.asp" target=_blank>http://61.128.97.225/vbgood/index.asp</a><br>拥有1800多个资料! </p></td>
</tr>
</table>
<p>
<CENTER><a href="http://www.jsp001.com/forum/newreply.php?action=newreply&threadid=505">点这里对该文章发表评论</a></CENTER>
<p>该文章总得分是 <font color=red>0</font> 分,你认为它对你有帮助吗?
[<a href=javascript:void(0) onclick=window.open("http://www.jsp001.com/forum/codeVote.php?threadid=505&intVote=4","","menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=no,width=70,height=40,top=0,left=0")>非常多</a>](<font color=red>0</font>)
[<a href=javascript:void(0) onclick=window.open("http://www.jsp001.com/forum/codeVote.php?threadid=505&intVote=2","","menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=no,width=70,height=40,top=0,left=0")>有一些</a>](<font color=red>0</font>)
[<a href=javascript:void(0) onclick=window.open("http://www.jsp001.com/forum/codeVote.php?threadid=505&intVote=1","","menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=no,width=70,height=40,top=0,left=0")>无帮助</a>](<font color=red>0</font>)
[<a href=javascript:void(0) onclick=window.open("http://www.jsp001.com/forum/codeVote.php?threadid=505&intVote=-1","","menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=no,width=70,height=40,top=0,left=0")>是灌水</a>](<font color=red>0</font>) </p>
<script language="javascript" src="http://www.jsp001.com/include/read_thread_script.php?threadid=505"></script>
<p><CENTER>
Copyright © 2001 - 2009 JSP001.com . All Rights Reserved <P>
<IMG SRC="../image/jsp001_small_logo.gif" WIDTH="85" HEIGHT="30" BORDER=0 ALT="">
</CENTER></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -