⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 weatherforecast.js

📁 图灵Ajax三剑客:《Ajax基础教程》、《Ajax实战》、《Ajax高级编程》的源代码
💻 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 + -