跑馬燈式的字符在狀態(tài)欄上出現(xiàn),一點(diǎn)出按鈕就停止
發(fā)布時(shí)間:2008-12-20 閱讀數(shù): 次 來源:網(wǎng)樂原科技
要完成此效果把如下代碼加入到區(qū)域中
<script language="javascript">
var scroll = true;
var num = 0;
function scrollStatus() {
var statusText = "";
var statusChars = new Array( 't','y','p','h','o','o','n',' ','s','t','a','r','t');
for (var l = 0; l < 1; l++) {
for (var a = num; a < statusChars.length; a++)
statusText += statusChars[a];
for (var b = 0; b < num; b++)
statusText += statusChars[b];
}
window.status = statusText;
num++;
if (num >= statusChars.length)
num = 0;
if (scroll) {
setTimeout("scrollStatus()",100);
}
}
scrollStatus();
</script>
<script language="javascript">
var num = 0;
scrollButton();
function scrollButton() {
var buttonChars = new Array('S', 't', 'o', 'p', ' ', 'S', 'c', 'r', 'o', 'l', 'l', 'i',
'n', 'g', ' ', ' ');
var buttonText = "";
for (var a = num; a < buttonChars.length; a++)
buttonText += buttonChars[a];
for (var b = 0; b < num; b++)
buttonText += buttonChars[b];
num++;
if (num >= buttonChars.length)
num = 0;
document.form1.stopIt.value = buttonText;
if (scroll) {
setTimeout("scrollButton();", 100);
}
}
</script>