html.title随机显示内容以及滚动显示内容
一、随机显示title内容:
var titleArr = ['111','222','333'] var index = Math.floor(Math.random() * titleArr.length); window.document.title = titleArr[index];
二、无限滚动title显示内容:
var repeat=0; var title=document.title; var titLeng=title.length; var start=0; var titTime; function titlemove() { titl=title.substring(start, titLeng) + title.substring(0, start); document.title=titl; start++; if (start==titLeng+1) { start=0 if (repeat==0) return } clearInterval(titTime); titTime = setInterval("titlemove()",1000); } if(document.title){ titlemove(); }
posted on 2018-06-06 10:33 婆婆买了只kitty 阅读(568) 评论(0) 编辑 收藏 举报