html標(biāo)題滾動(dòng)例子
Posted on 2010-11-22 09:37 瘋狂 閱讀(3631) 評(píng)論(3) 編輯 收藏 所屬分類(lèi): java 、web首先是:
titlescroll.js文件
function titleScroll(title_string,timestoloop){
var index_count = 0;
var cmon;
var kill_length = 0;
var times = 0;
var title_string = title_string;
var title_length = title_string.length;
var timestoloop = timestoloop;
this.scrollTheTitle = function(){
var doc_title = title_string.substring(index_count,title_length);
document.title = doc_title;
index_count++;
};
this.loopTheScroll = function(){
var my = this;
my.scrollTheTitle();
if(kill_length >= title_length)
{
if(times+1<timestoloop){
times++;
kill_length=0;
index_count=0;
cmon = setTimeout(function(){my.loopTheScroll();},0)
}else{
clearTimeout(cmon);
}
}else{
kill_length++;
// alert(kill_length);
//alert(times);
cmon = setTimeout(function(){my.loopTheScroll();},300);
}
}
}
調(diào)用:
var sc = new titleScroll("這是要滾動(dòng)的內(nèi)容",2);//參數(shù)1: 要滾動(dòng)的內(nèi)容,參數(shù)2:滾動(dòng)的次數(shù)
c.loopTheScroll();
例子下載
/Files/freeman1984/sc.rar
titlescroll.js文件








































調(diào)用:
var sc = new titleScroll("這是要滾動(dòng)的內(nèi)容",2);//參數(shù)1: 要滾動(dòng)的內(nèi)容,參數(shù)2:滾動(dòng)的次數(shù)
c.loopTheScroll();
例子下載
/Files/freeman1984/sc.rar