Do not use onchange=<inline script>, instead add listeners in init
Peter Palfrader

Peter Palfrader commited on 2017-03-19 18:31:41
Zeige 2 geänderte Dateien mit 7 Einfügungen und 3 Löschungen.

... ...
@@ -49,6 +49,10 @@ var software = {
49 49
 };
50 50
 
51 51
 function init() {
52
+    document.getElementById("distrib").addEventListener("change", update);
53
+    document.getElementById("package").addEventListener("change", update);
54
+    document.getElementById("version").addEventListener("change", update);
55
+
52 56
     pkg = document.getElementById('package');
53 57
     for (soft in software) {
54 58
         if (soft != pkg.value) {
... ...
@@ -70,7 +70,7 @@ For Ubuntu, ask <a href="https://en.wikipedia.org/wiki/List_of_Ubuntu_releases#T
70 70
 <div id="selector" style="display: none;">
71 71
 <blockquote>
72 72
 I run
73
-<select id="distrib" onchange="update()">
73
+<select id="distrib">
74 74
 <option value="wheezy">Debian oldstable (wheezy)</option>
75 75
 <option value="jessie" selected="selected">Debian stable (jessie)</option>
76 76
 <option value="stretch">Debian testing (stretch)</option>
... ...
@@ -80,9 +80,9 @@ I run
80 80
 <option value="xenial">Ubuntu Xenial Xerus</option>
81 81
 </select>
82 82
 and want
83
-<select id="package" onchange="update()"></select>
83
+<select id="package"></select>
84 84
 version
85
-<select id="version" onchange="update()"></select>
85
+<select id="version"></select>
86 86
 </blockquote>
87 87
 
88 88
 
89 89