状态栏滚动文字
时间:2007-02-17 来源:PHP爱好者
功能:使浏览器的状态栏中出现滚动文字,而不影响内部格式。 m1和m2是两个变量可自行添加和修改其中的内容。 这个功能不需要添加文件,十分方便而且不影响浏览速度。
在</TITLE>后添加以下代码:
<SCRIPT LANGUAGE="JavaScript">
<!--
function scroll(seed)
{
var m1 = " ****网页制作大宝库-最大的网页素材库**** "
var m2 = "网页素材,各类教程,相关软件下载,应有尽有"
var msg=m1+m2;
var out = " ";
var c = 1;
if (seed > 100) {
seed--;
var cmd="scroll(" + seed + ")";
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 100 && seed > 0) {
for (c=0 ; c < seed ; c++) {
out+=" ";
}
out+=msg;
seed--;
var cmd="scroll(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,100);
} else if (seed <= 0) {
if (-seed < msg.length) {
out+=msg.substring(-seed,msg.length);
seed--;
var cmd="scroll(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,100);
}
else {
window.status=" ";
timerTwo=window.setTimeout("scroll(100)",7);
}
}
}
timerONE=window.setTimeout('scroll(100)',50);
//-->
</SCRIPT>
php爱好者站 http://www.phpfans.net php动态|php基础|php进阶|php模板.
在</TITLE>后添加以下代码:
<SCRIPT LANGUAGE="JavaScript">
<!--
function scroll(seed)
{
var m1 = " ****网页制作大宝库-最大的网页素材库**** "
var m2 = "网页素材,各类教程,相关软件下载,应有尽有"
var msg=m1+m2;
var out = " ";
var c = 1;
if (seed > 100) {
seed--;
var cmd="scroll(" + seed + ")";
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 100 && seed > 0) {
for (c=0 ; c < seed ; c++) {
out+=" ";
}
out+=msg;
seed--;
var cmd="scroll(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,100);
} else if (seed <= 0) {
if (-seed < msg.length) {
out+=msg.substring(-seed,msg.length);
seed--;
var cmd="scroll(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,100);
}
else {
window.status=" ";
timerTwo=window.setTimeout("scroll(100)",7);
}
}
}
timerONE=window.setTimeout('scroll(100)',50);
//-->
</SCRIPT>
php爱好者站 http://www.phpfans.net php动态|php基础|php进阶|php模板.
相关阅读 更多 +