-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunderscore.html
More file actions
67 lines (63 loc) · 1.38 KB
/
underscore.html
File metadata and controls
67 lines (63 loc) · 1.38 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="">
<script src="underscore.js"></script>
<script src="jquery-1.7.2.min.js"></script>
<style>
html,body{
margin: 0;
padding: 0;
width: 100%;
height:100%;
}
#myCanvas{
width: 100%;
height: 100%;
}
#footer{
position: absolute;
bottom: 0;
width: 100%;
height: 120px;
background: green;
}
</style>
</head>
<body>
<canvas id="myCanvas"></canvas>
<div id="footer"></div>
<script type="text/javascript">
var canvas=document.getElementById("myCanvas");
var cxt=canvas.getContext("2d");
function resizeCanvas() {
var canvas=$("#myCanvas");
canvas.attr("width", document.body.offsetWidth);
canvas.attr("height", document.body.offsetHeight);
cxt.rect(0, 0, canvas.width(), canvas.height());
cxt.fillStyle="#fff";
cxt.fill();
};
resizeCanvas();
</script>
<script>
//冒泡排序
var orderArr = [5,1,6,3,9],
i,
j,
middle,
len = orderArr.length;
for(i=0;i<len;i++){
for(j=i+1;j<len;j++){
if(orderArr[i]>orderArr[j]){
middle = orderArr[i];
orderArr[i] = orderArr[j];
orderArr[j] = middle
}
}
}
console.log(orderArr);
// _.each([1,2,3],function(i){console.log(this.name+" "+i)},{name:"test"})
</script>
</body>
</html>