-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.html
More file actions
55 lines (46 loc) · 1.18 KB
/
demo.html
File metadata and controls
55 lines (46 loc) · 1.18 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
<html>
<head>
<title>ceshi</title>
<meta charset="utf-8">
</head>
<body>
<h1>测试</h1>
<input type="button" value="测试log" onclick="activityList({'key':'value'})">
<input type="button" value="showLog" onclick="showLog('hello world')">
<br>
<br>
<br>
<img src="http://a2.att.hudong.com/71/04/300224654811132504044925945_950.jpg">
<img src="http://d6.yihaodianimg.com/N03/M04/16/3D/CgQCs1N5MUiATsxVAADJLWXi5mk84700.jpg">
<img src="http://www.xahongbei.com/uploads/allimg/150528/1_150528104904_1.jpg">
<h1>asdaSD</h1>
</body>
<script type="text/javascript">
function activityList(){
showLog("hello world");
}
function indexOf(arr, str){
if (arr && arr.indexOf) {
return arr.indexOf(str);
}
var len = arr.length;
for(var i = 0; i < arr.length; i ++){
if(arr[i] == str){
return i;
}
}
return 0;
}
var images = document.getElementsByTagName("img");
var urls = new Array();
for (var i = 0; i < images.length; i++) {
urls.push(images[i].src);
}
for (var i = 0; i < images.length; i++) {
images[i].addEventListener('click', function(e, a){
var index = indexOf(urls, e.srcElement.src);
showBigView(urls, index);
}, false);
}
</script>
</html>