📄 weatherforecast.js
字号:
var weatherForecastIntervalID = 0;function updateWeatherForecast() { var ajaxRequest = new AjaxRequest("UpdateWeatherForecast"); ajaxRequest.addFormElementsById("forecastZipCode"); ajaxRequest.sendRequest();}function handleZipCodeChange() { var zipCode = document.getElementById("forecastZipCode").value; if(isValidZipCode(zipCode)) { updateWeatherForecast(); startWeatherUpdateInterval(); } else { if(weatherForecastIntervalID != 0) { window.clearInterval(weatherForecastIntervalID); weatherForecastIntervalID = 0; } }}function startWeatherUpdateInterval() { weatherForecastIntervalID = window.setInterval("updateWeatherForecast()", 300000);}function isValidZipCode(zip) { if(zip.length == 5 && isAllDigits(zip)) { return true; } return false;}function isAllDigits(argvalue) { argvalue = argvalue.toString(); var validChars = "0123456789"; var startFrom = 0; for (var n = startFrom; n < argvalue.length; n++) { if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) { return false; } } return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -