JavaScriptのタイトル変更
3041 ワード
このコードは4秒以内にあなたのタイトルを変更します.
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
40
41
42
43
44
45
46
47
48
49
50
51
52
1
<title></title>
JavaScript <script>
:
12
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
40
41
42
43
44
45
46
47
48
49
50
51
52
/* Begin */
var
message =
new
Array();
message[0] =
"Welcome to our site"
;
message[1] =
"Here you'll find exactly what you need"
;
message[2] =
"We know how to solve your problems.."
;
var
reps = 1;
var
speed = 200;/ / ( )。
var
hold = 4 / /
/ / (larger number = slower action)
/ / 。
var
p = message.length;
var
q = 0;
var
r = 0;
var
C = 0;
var
mC = 0;
var
s = 0;
var
sT =
null
;
if
(reps < 1) {
reps = 1;
}
function
setMessage() {
typing = message[mC];
q = typing.length;
r = q + hold;
typeMessage();
}
function
typeMessage() {
if
(s > r) {
s = 0;
}
if
(s > q) {
document.title = '
'+ typing +'
- - -
';
}
else {
document.title = '
'+ typing.substr(0,s)+'
- - -';
}
if
(C < (r * reps)) {
sT = setTimeout(
"typeMessage()"
, speed);
C++;
s++;
}
else
{
C = 0;
s = 0;
mC++;
if
(mC > p - 1) {mC = 0;}
sT =
null
;
setMessage();
}
}
setMessage();
/* end*/