OLD | NEW |
| (Empty) |
1 <?xml version="1.0"?> | |
2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
3 <head> | |
4 <title>Testing Typing into body</title> | |
5 <script type="text/javascript"> | |
6 function setMessage(message) { | |
7 document.getElementById('result').innerHTML = message; | |
8 } | |
9 | |
10 function showSelected() { | |
11 var selectElement = document.getElementById('multi'); | |
12 if (selectElement == null) { | |
13 appendMessage("null!"); | |
14 } | |
15 | |
16 var options_array = selectElement.getElementsByTagName('option'); | |
17 var selected_cheese = ""; | |
18 for (var i = 0; i < options_array.length; i++) { | |
19 if (options_array[i].selected) { | |
20 selected_cheese = selected_cheese + options_array[i].label + " "; | |
21 } | |
22 } | |
23 setMessage(selected_cheese); | |
24 } | |
25 </script> | |
26 </head> | |
27 | |
28 <body> | |
29 <h1>Type Stuff</h1> | |
30 | |
31 <div id="result"> | |
32 | |
33 </div> | |
34 | |
35 <form action="" id="on-form" name="multichoice"> | |
36 <select name="multi" id="multi" multiple="multiple"> | |
37 <option selected="selected" label="emmental">Emmental</option> | |
38 <option label="roquefort" >Roquefort</option> | |
39 <option label="parmigiano">Parmigiano</option> | |
40 <option label="cheddar">Cheddar</option> | |
41 </select> | |
42 </form> | |
43 | |
44 <input type="button" name="showselected" onclick="showSelected()" value="Show
selected"/> | |
45 </body> | |
46 | |
OLD | NEW |