-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhome.html
111 lines (101 loc) · 3.43 KB
/
home.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="./Tools.js"></script>
</head>
<body>
<div id="millisecondCountDown" style="height: 10000px; background: pink;"></div>
<script>
// var str = 'yyyyMMYYYY';
// var re1 = /(y+|M+)/gi;
// var re2 = /[yM]+/gi
// console.log(str.match(re1))
// console.log(str.match(re2))
// console.log(Tools.DateToTimestamp('2018-05-01 12:12:11'));
//2018/4/7 18:33:20
// console.log(Tools.TimestampToDate('yyyyMM', +new Date()))
// console.log(Tools.ToCurrency('12.25'))
// Tools.setCookies('name', 'wzh', 200, {
// // path: '/',
// // domain: 'www.baidu.com'
// })ds
// Tools.setCookies('age', '19', 200, {
// // path: '/',
// // domain: 'www.baidu.com'
// })
// console.log(Tools.getCookie('name'));
// Tools.clearCookies('age')
// console.log();
// Tools.setLocalStorage('test', 'wzh');
// Tools.setLocalStorage('name', {
// name: 'wzh',
// age: '18',
// address: '广东深圳'
// }, -100);
// console.log(Tools.getLocalStorage('test'));
// console.log(Tools.getLocalStorage('name'));
// Tools.clearLocalStorage();
// var time = 24 * 60 * 60 + 4;
// setInterval(function() {
// time--;
// console.log(Tools.secondCountDown(time));
// }, 1000);
// var millisecondCountDown = document.getElementById('millisecondCountDown');
// time = 10 * 100;
// setInterval(function() {
// time -= 10;
// if(time <= 0) {
// time = 10 * 100;
// }
// millisecondCountDown.innerHTML = Tools.millisecondCountDown(time)
// }, 100)
// var a = Tools.phoneNumberFormat('18924298711');
// console.log(a)
// var b = Tools.emailFormat('[email protected]');
// console.log(b)
// var parmas = [
// {name: 'wzh', age: 18},
// {name: 'xm', age: 19},
// ];
// // var arr = parmas;
// // arr[0] = 1;
// // console.log(parmas);
// var arr = Tools.deepCopy(parmas);
// arr[0] = 1;
// console.log(arr, parmas);
var fn = Tools.throttle(function(res) {
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop
console.log(scrollTop);
}, 1000)
// console.log(fn)
window.onscroll = function(e) {
fn()
}
//防抖
// var fn = Tools.debounce(function(res) {
// console.log(this, res)
// }, 1000)
// window.onresize = function() {
// fn.call({name: 'wzh'}, 1);
// }
//数字添加逗号
// console.log(Tools.filerNumber(1202455));
// console.log('null的显示: ', Tools.monetizationNumber(null));
// console.log('10000的显示: ',Tools.monetizationNumber('10000'));
// console.log('10000的显示: ',Tools.monetizationNumber('10000', 0));
// console.log('1202455.10的显示: ',Tools.monetizationNumber(1202455.10));
// console.log('12455.5的显示: ',Tools.monetizationNumber('12455.5'));
// console.log('1245121212125.52631的显示: ',Tools.monetizationNumber('1245121212125.52631', 3));
// 限制输入
// console.log('12.00结果为:', Tools.suretyFloat('12.00', 0));
// console.log('12.结果为:', Tools.suretyFloat('12.', 0));
// console.log('12.99结果为:', Tools.suretyFloat('12.99', 1));
// console.log('aaaa结果为:', Tools.suretyFloat('aaaa'));
// console.log('12.01结果为:', Tools.suretyFloat('12.01', 2, true, 0, 12));
// console.log('-101结果为:', Tools.suretyFloat('-101', 2, true, -10, 100));
// console.log('101结果为:', Tools.suretyFloat('101', 2, true, -10, 100));
</script>
</body>
</html>