短信息来回反射在状态栏中。
点击并期待在您的浏览器下方的状态栏当前的反弹为文本的示例。
JavaScript函数:
<script language="JavaScript">
<!--
var yourwords = "* JavaScript Search - Your Source for Free JavaScripts *";
var buffer1=" ";
var buffer2=" ";
var message1=buffer1+yourwords+buffer2;
var dir = "left";
var speed = 75;
function pingpong()
{
if (dir == "left")
{
message2=message1.substring(2,message1.length)+" ";
window.status=message2;
setTimeout("pingpong();",speed);
message1=message2;
if (message1.substring(0,1) == "*") dir="right";
}
else
{
message2=" "+message1.substring(0,message1.length-2);
window.status=message2;
setTimeout("pingpong();",speed);
message1=message2;
if (message1.substring(message1.length-1,message1.length) == "*") dir="left";
}
}
// -->
</script>
<FORM>
Click <INPUT TYPE=BUTTON VALUE="Start" onclick="pingpong();"> and look in your current status bar on the bottom of your browser for an example of bouncing text.
</FORM>
|