forked from AlligatorJack/CICWebCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestsite2.html
42 lines (37 loc) · 948 Bytes
/
testsite2.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang=en>
<head>
<title></title>
<style type="text/css">
div {width:200px;padding:20px;cursor:hand;background-color:#eee;margin:15px 0}
</style>
<script type="text/javascript">
function AttachAllDivEvents()
{
var divCollection = document.getElementsByTagName("div");
for (var i=0; i<divCollection.length; i++)
{
AttachDivClickEvent(divCollection[i]);
}
}
function AttachDivClickEvent(divObj)
{
divObj.onclick = function()
{
document.getElementById("count").innerHTML = parseInt(document.getElementById("count").innerHTML) + 1;
};
}
window.onload = AttachAllDivEvents;
</script>
</head>
<body>
<div>Blah1</div>
<div>Blah2</div>
<div>Blah3</div>
<div>Blah4</div>
<div>Blah5</div>
<div>Blah6</div>
<br />
<p id="count" style="font:bold 20px Times;color:red;text-indent:20px">1</p>
</body>
</html>