forked from gsi-cyberjapan/gsimaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
counter.html
50 lines (39 loc) · 1.86 KB
/
counter.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
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html lang="ja">
<head>
<link rel="shortcut icon" href="http://portal.cyberjapan.jp/favicon.ico" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0, ,user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>地理院地図(アクセスカウンター)</title>
<script type="text/javascript" src="./js.lib/jquery/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
var vURL = './cgi-bin/CounterJson.php?id=001';
function Init(){
var o = document.getElementById("counter");
if(o != null){
$.ajax(
{ url : vURL }
)
.done(
function(data, status, jqXHR){
var dataCounter = JSON.parse(data);
var today = new Date();
var yesterday = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 1);
var todayCaption = ( '00' + ( today.getMonth() + 1 ) ).slice(-2) + '/' +( '00' + today.getDate() ).slice(-2);
var yesterdayCaption = ( '00' + ( yesterday.getMonth() + 1 ) ).slice(-2) + '/' + ( '00' + yesterday.getDate() ).slice(-2);
o.innerHTML = todayCaption + ' ' + dataCounter.today + '、' + yesterdayCaption +' ' + dataCounter.yesterday + '、' + '総計 ' + ( dataCounter.total + '' ).replace( /(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
}
)
.fail(
function(data, status, error){
}
);
}
};
</script>
</head>
<body onload="Init();">
<div id="counter"></div>
</body>
</html>