This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. <html> <div class=left><select id=climate name=climate> <option value=1>Cold</option> <option value=2>Temperate</option> <option value=3>Hot</option> </select> Climate<br> <select width=200 id=season name=season> <option value=0>Spring</option> <option value=1>Summer</option> <option value=0>Autumn</option> <option value=-1>Winter</option> </select> Season<br> <a href="Javascript:getWeather()"><button>Generate</button></a> <a href="Javascript:clearWeather()"><button>Clear</button></a><br></div> <script type="text/javascript"> var day = 0; function clearWeather() { day = 0; document.getElementById("weatherResult").innerHTML = ""; } function getWeather() { var climate = document.getElementById("climate").value; var season = document.getElementById("season").value; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var result = this.responseText.split("", 1); day = +day + +result; var genResult = this.responseText.substr(1); document.getElementById("weatherResult").innerHTML = document.getElementById("weatherResult").innerHTML+genResult; } }; xhttp.open("GET", "weathergen/swwg.php?climate="+climate+"&season="+season+"&day="+day, true); xhttp.send(); } </script> <style> #climate { width: 200px; } #season { width: 200px; } .left { float: left; width: 30%; } #weatherResult { float: left; width: 70%; } </style> <div id="weatherResult"></div> </html> weathergen.txt Last modified: 2017/12/29 16:57by Chronos