-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepository.html
118 lines (114 loc) · 4.17 KB
/
repository.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
112
113
114
115
116
117
118
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>常用函数</title>
<meta name="Keywords" content="与我联系" />
<meta name="Description" content="与我联系" />
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="js/googledock.1.0.0.js"></script>
<!--[if IE 6]>
<script src="js/DD_belatedPNG_0.0.8a-min.js"></script>
<script type="text/javascript">
//png图片兼容处理
DD_belatedPNG.fix('.logo img');
</script>
<![endif]-->
<link href="image/me.ico" rel="shortcut icon"type="image/png" />
<link href="css/top.css" rel="Stylesheet" type="text/css" media="screen" />
<link href="css/repository.css" rel="Stylesheet" type="text/css" media="screen" />
</head>
<body>
<div class="top">
<div class="logo"><img src="image/mylogo.png" alt="何燕珠--前端开发" /></div>
<div class="nav">
<div class="dock_container">
<a class="dock_item" href="index.html"><span>我的首页</span><img src="image/dock/home.png" alt="我的首页" /></a>
<a class="dock_item" href="work.html"><span>我的作品</span><img src="image/dock/portfolio.png" alt="我的作品" /></a>
<a class="dock_item" href="mark.html"><span>我的经验</span><img src="image/dock/history.png" alt="我的经验" /></a>
<a class="dock_item" href="book.html"><span>我的书架</span><img src="image/dock/book.png" alt="我的书架" /></a>
<a class="dock_item" href="index.html"><span>我的简历</span><img src="image/dock/calendar.png" alt="我的简历" /></a>
<a class="dock_item" href="contact.html"><span>与我联系</span><img src="image/dock/email.png" alt="与我联系" /></a>
</div>
</div><!--end of nav-->
</div><!--end of top-->
<div class="main">
<h2>与我联系</h2>
<div class="contact_content">
<ul class="repository">
<li>
<span class="jsitems">兼容的(绑定或取消)事件处理器</span>
<pre>
<b>延迟加载版本:</b>
function addHandler(target,eventType,handler){//事件绑定
if(target.addEventListener){
addHandler = function(target,eventType,handler){
target.addEventListener(eventType,handler,false);
};
}
else{//IE
addHandler = function(target,eventType,handler){
target.attachEvent("on"+eventType,handler);
};
}
}
function removeHandler(target,eventType,handler){//取消事件绑定
if(target.removeEventListener){
removeHandler = function(target,eventType,handler){
target.removeEventListener(eventType,handler,false);
};
}
else{//IE
removeHandler = function(target,eventType,handler){
target.detachEvent("on"+eventType,handler);
};
}
}
<b>条件预加载版本:</b>
var addHandler = document.body.addEventListener?
function(target,eventType,handler){
target.addEventListener(eventType,handler,false);
}:
function(target,eventType,handler){
target.attachEvent("on"+eventType,handler);
};
var removeHandler = document.body.removeEventListener?
function(target,eventType,handler){
target.removeEventListener(eventType,handler,false);
}:
function(target,eventType,handler){
target.detachEvent("on"+eventType,handler);
};
</pre>
</li>
<li>
<span class="jsitems">为数组元素添加样式</span>
<pre>
function arrayAddClass(obj,class){
for(var i=0;i < obj.length;i++){
+function(i){
obj[i].onclick = function(){
if(obj[i].className == ""){obj[i].className = class;}
else{obj[i].className = "";}
}
}(i);
}
}
</pre>
</li>
</ul>
</div><!--end of contact_content-->
</div><!--end of main-->
<script type="text/javascript" src="js/nav.js"></script>
<script>
$(function(){
$('.jsitems').each(function(){
$(this).click(function(){
var toggleTarget = $(this).next('pre');
toggleTarget.toggle(200);
});
});
}());
</script>
</body>
</html>