-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathL8.1.html
More file actions
46 lines (42 loc) · 1.29 KB
/
L8.1.html
File metadata and controls
46 lines (42 loc) · 1.29 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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script>
function catchEvent(eventObj,event,eventHandler){
if(eventObj.addEventListener,event,eventHandler){
eventObj.addEventListener(event,eventHandler,false);
}else if(eventObj.attachEvent){
event = "on"+event;
eventObj.attachEvent(event,eventHandler);
}
}
catchEvent(window,"load",setupEvent);
function setupEvent(evnt){
catchEvent(document.getElementById("someForm"),"submit",checkForm);
}
function checkForm(evnt){
var opts = document.getElementById("someForm").selectOpts.options;
for(var i = 0;i<opts.length;i++){
if(opts[i].selected){
alert(opts[i].text + "" +opts.value);
}
}
return false;
}
</script>
</head>
<body>
<form id="someForm" action="">
<p>
<select id="selectOpts" multiple="multiple">
<option value="Opt1">Option One</option>
<option value="Opt2">Option Two</option>
<option value="Opt3">Option There</option>
</select>
<input type="submit" value="Submit">
</p>
</form>
</body>
</html>