-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.html
70 lines (69 loc) · 1.72 KB
/
sample.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html>
<head>
<title>formatDate-js Sample</title>
<style type="text/css">
body{font-family:sans-serif;font-size:18px;color:#444;}
button{width:120px;height:40px;background-color:#fff;color:#047;border:1px solid #047;border-radius:4px;font-weight:bold;cursor:pointer;}
button:hover{background-color:#047;color:#fff;}
table{margin:0px auto 0px auto;}
td>div{margin:2px 10px;height:30px;padding-top:6px;width:280px;border:2px dashed #ddd;text-align: center;}
</style>
<script type="text/javascript" src="formatdate-min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
//Set DIV text to formatted current date according to specifier text of corresponding BUTTON
$('button').click(function(){var $button=$(this);$($('tr').filter(function(){return $(this).index()==$button.parent().parent().index();})).find("td>div").text(
formatDate(new Date(),$(this).text())
);})
});
</script>
</head>
<body>
<table>
<tr>
<td>
<button>%Y-%m-%d</button>
</td>
<td><div></div></td>
</tr>
<tr>
<td>
<button>%W, %M %D, %Y</button>
</td>
<td><div></div></td>
</tr>
<tr>
<td>
<button>%d %b %y</button>
</td>
<td><div></div></td>
</tr>
<tr>
<td>
<button>%c/%d/%y</button>
</td>
<td><div></div></td>
</tr>
<tr>
<td>
<button>%r</button>
</td>
<td><div></div></td>
</tr>
<tr>
<td>
<button>%T</button>
</td>
<td><div></div></td>
</tr>
<tr>
<td>
<button>%g %%c%%%c</button>
</td>
<td><div></div></td>
</tr>
</table>
</body>
</html>