forked from yangshuangding/javaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path滚动title.html
39 lines (38 loc) · 876 Bytes
/
滚动title.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
<meta content="text/html" charset="utf-8">
<title></title>
<style type="text/css">
*{
margin:0;
padding:0;
font-family:'微软雅黑';
}
img{
float:left;
}
</style>
</head>
<body>
</body>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript">
var position=0;
var message='^_^欢迎浏览本网站';
var x=2*(60/message.length);//要保证是两倍
var newStr='';
for(var i=0;i<x;i++){
newStr+=message;
}
function titleTex(){
var title=newStr.substring(position,position+60);
position++;
if(position==60){//刚好截取到尾巴
position=0;
}
document.title=title;
}
setInterval(titleTex,150);
</script>
</html>