Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <script>
- window.onload = function() {
- loadDivList();
- };
- function loadDivList() {
- var xmlhttp = new XMLHttpRequest(); //Object for handling xmlhttp requests
- xmlhttp.onreadystatechange=function() {
- if (xmlhttp.readyState==4 && xmlhttp.status==200) {
- divListContent = "<option value=\"-1\"> Seleccione una division </option>";
- divListContent += "<option value=\"0\"> Equipos sin division </option>";
- divListContent += xmlhttp.responseText;
- document.getElementById("divList").innerHTML = divListContent;
- }
- }
- xmlhttp.open("GET","getDivList.php",true);
- xmlhttp.send();
- }
- function loadTeamList() {
- var xmlhttp = new XMLHttpRequest(); //Object for handling xmlhttp requests
- var divSelector = document.getElementById("teamList");
- var selectedDiv = divSelector.options[divSelector.selectedIndex].value;
- var teamListContent = document.getElementById("teamList").innerHTML;
- if (selectedDiv == -1) {
- document.getElementById("teamList").innerHTML = "<option value=\"-1\"> Seleccione una division </option>";
- return;
- }
- xmlhttp.onreadystatechange=function() {
- if (xmlhttp.readyState==4 && xmlhttp.status==200) {
- teamList = "<option value=\"-1\"> Seleccione un equipo </option>";
- teamListContent += xmlhttp.responseText;
- document.getElementById("teamList").innerHTML = teamListContent;
- }
- }
- alert("getTeamList.php?q="+selectedDiv);
- xmlhttp.open("GET","getTeamList.php?q="+selectedDiv,true);
- xmlhttp.send();
- }
- </script>
- </head>
- <body>
- <select name="divList" id="divList" onChange="loadTeamList();">
- <option value="-1"> Seleccione una division </option>
- </select>
- <select name="teamList" id="teamList">
- <option value="-1"> Seleccione una division </option>
- </select>
- <br>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement