-
Notifications
You must be signed in to change notification settings - Fork 1
/
lista.html
63 lines (54 loc) · 1.4 KB
/
lista.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script>
function getHttpObject(){
var XMLHttp;
if (window.XMLHttpRequest) {
XMLHttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
return XMLHttp;
}
var http = getHttpObject();
function getData(){
if(http){
var lista = document.getElementById('lista').value;
var url="cgi-bin/options.pl?lista="+lista;
http.onreadystatechange = function(){
var combo = document.getElementById('combo');
var contenido = document.getElementById('contenido');
if(http.readyState == 1){
combo.length = 0;
var nuevaOpcion = document.createElement("option");
nuevaOpcion.value = 0;
nuevaOpcion.innerHTML="Cargando...";
combo.appendChild(nuevaOpcion);
combo.disabled = true;
}
if(http.readyState==4 && http.status == 200){
contenido.innerHTML = http.responseText;
combo.disabled = false;
}
}
http.open("GET",url,true);
http.send();
}
}
</script>
</head>
<body>
<select name=lista id=lista onChange="getData();">
<option value=0>seleccione</option>
<option value=lista1>lista1</option>
<option value=lista2>lista2</option>
</select>
<div id="contenido">
<select name=combo id=combo>
<option value=0>seleccione una lista</option>
</select>
</div>
</body>
</html>