title全为空字符相当于不写title

第一种实现:

<script type="text/javascript">
var tt=document.title;
tt = "…" + tt;
var pos=0;
function scrollMsg(){
document.title=tt.substring(pos,tt.length)+tt.substring(0,pos)
pos++;
if(pos>tt.length){
pos=0;
}
window.setTimeout(scrollMsg,400)
}
scrollMsg()
</script>

 

 

第二种实现(空白和文字切换):

<script>
var step=0;
var _title=document.title;
var space='';
for(var i=0;i<_title.length;i++){
space+=" ";
}
function flashTitle(){
step++;
if(step==3){
step=1;
}
if(step==1){
document.title=space;
}
if(step==2){
document.title=_title;
}
setTimeout(flashTitle,500);
}
flashTitle();
</script>

第三种实现:

<script>
setInterval(function(){
var tt=document.title;
document.title=tt.substr(1)+tt.charAt(0);
},50)
</script>