自動刷新頁面取客戶端時間并給URL參數賦值
1
<html>
2
<head>
3
<title>自動刷新頁面取客戶端時間</title>
4
</head>
5
<body>
6
<a href="test.html" id="selfLink"/>
7
<script lang="javascript">
8
9
function refresh()
{
10
var date = new Date();
11
Hour = date.getHours();
12
Minute = date.getMinutes();
13
Second = date.getSeconds();
14
Year = date.getYear();
15
Month = date.getMonth()+1;
16
Day = date.getDate();
17
var dateFormat = Year+"-"+Month+"-"+Day+" "+Hour+":"+Minute+":"+Second;
18
window.open(document.getElementById('selfLink').href + "?"+dateFormat,"_self");
19
}
20
21
setTimeout("refresh()", 5000);
22
</script>
23
</body>
24
</html>

2

3

4

5

6

7



8

9



10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

posted on 2005-11-16 15:50 bluesky 閱讀(855) 評論(0) 編輯 收藏 所屬分類: HTML/CSS