符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
这篇文章主要讲解了“如何编写asp配合AJAX天气预报的webService”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“如何编写asp配合AJAX天气预报的webService”吧!
10余年的永昌网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。全网整合营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整永昌建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联公司从事“永昌网站设计”,“永昌网站推广”以来,每个客户项目都认真落实执行。代码如下:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<%
Session.CodePage = "65001"
Response.contentType="text/html"
Response.Expires = 0
var N=Request("n")
var Num=Request("id")
var url="http://xml.weather.yahoo.com/forecastrss?p="+N+"&u=c&id="+Num;
var xmldoc=Server.CreateObject("Microsoft.Xmlhttp");
xmldoc.open('GET',url,false);
xmldoc.send(null);
var response = xmldoc.responseXML.documentElement;
var lastNode=response.selectNodes("//rss/channel/lastBuildDate");
var cityNode=response.selectNodes("//rss/channel/yweather:location");
var windNode=response.selectNodes("//rss/channel/yweather:wind");
var atmosphereNode=response.selectNodes("//rss/channel/yweather:atmosphere");
var astronomyNode=response.selectNodes("//rss/channel/yweather:astronomy");
var conditionNode=response.selectNodes("//rss/channel/item/yweather:condition");
var forecastNode=response.selectNodes("//rss/channel/item/yweather:forecast");
var lastV=lastNode(0).firstChild.nodeValue
//编辑属性
function attri(a,b,c){
return a(b).attributes.getNamedItem(c).value
}
var cityV=attri(cityNode,0,"city")
var chillV=attri(windNode,0,"chill")
var directionV=attri(windNode,0,"direction")
var speedV=attri(windNode,0,"speed")
var humidityV=attri(atmosphereNode,0,"humidity")
var visibilityV=attri(atmosphereNode,0,"visibility")
var sunriseV=attri(astronomyNode,0,"sunrise")
var sunsetV=attri(astronomyNode,0,"sunset")
var textV=attri(conditionNode,0,"text")
var codeV=attri(conditionNode,0,"code")
var tempV=attri(conditionNode,0,"temp")
//转换英文为中文
var cityCH=EN2CH(cityV)
function EN2CH(obj){
if(obj=="Wuhan"){return "武汉"}
else if(obj=="Nanchang"){return "南昌"}
else if(obj=="Haikou"){return "海口"}
else if(obj=="Beijing"){return "北京"}
else if(obj=="Shanghai"){return "上海"}
else if(obj=="Guangzhou"){return "广州"}
else if(obj=="Yinchuan"){return "银川"}
else if(obj=="Zhengzhou"){return "郑州"}
else if(obj=="Changsha"){return "长沙"}
else if(obj=="Hanzhong"){return "杭州"}
else if(obj=="Hong Kong"){return "香港"}
else if(obj=="Xin'an"){return "西安"}
else if(obj=="Chengdu"){return "成都"}
else if(obj=="Qingdao"){return "青岛"}
else if(obj=="Guiyang"){return "贵阳"}
else if(obj=="Jinan"){return "济南"}
else if(obj=="Hefei"){return "合肥"}
else if(obj=="Fuzhou"){return "福州"}
else if(obj=="Nanjing"){return "南京"}
else{return obj}
}
//风向函数
var windCH=wind(directionV)
function wind(a){
if(a>337 && a<=360){return "北风"};
else if(a>=0 && a<=22){return "北风"};
else if(a>22 && a<=67){return "东北风"};
else if(a>67 && a<=112){return "东风"};
else if(a>112 && a<=157){return "东南风"};
else if(a>157 && a<=202){return "南风"};
else if(a>202 && a<=247){return "西南风"};
else if(a>247 && a<=292){return "西风"};
else if(a>292 && a<=337){return "西北风"};
}
//能见度函数
visibility=vis(visibilityV)
function vis(a){
return a/100
}
//转换天气为中文
var textCH=tEN2CH(textV)
function tEN2CH(obj){
if(obj=="Clear"){return "晴朗"}
else if(obj=="Sunny"){return "晴天"}
else if(obj=="Partly Cloudy"){return "局部有云"}
else if(obj=="Mostly Clear"){return "晴"}
else if(obj=="Mostly Sunny"){return "小云"}
else if(obj=="Mostly Cloudy"){return "多云"}
else if(obj=="Cloudy"){return "云"}
else if(obj=="Sunny/Wind"){return "晴转云"}
else if(obj=="AM Clouds/PM Sun/Wind"){return "云转晴"}
else if(obj=="AM Showers"){return "晨雨"}
else{return obj}
}
//天气图片
var weaNum=weaimg(codeV)
function weaimg(obj){
return ""
}
//星期替换
function dayEn(obj){
if(obj=="Sun"){return "星期日"}
else if(obj=="Mon"){return "星期一"}
else if(obj=="Tue"){return "星期二"}
else if(obj=="Wed"){return "星期三"}
else if(obj=="Thu"){return "星期四"}
else if(obj=="Fri"){return "星期五"}
else if(obj=="Sat"){return "星期六"}
else{return obj}
}
%>
<%=cityCH%> <%=weaNum%> <%=textCH%> | 感觉: | <%=chillV%>° |
实际: | <%=tempV%>° | |
风向: | <%=windCH%> | |
风速: | <%=speedV%>Kph | |
湿度: | <%=humidityV%>% | |
能见度: | <%=visibility%>km |
<%=lastV%> | |
日出:<%=sunriseV%> | 日落:<%=sunsetV%> |
<%=dayCH%> <%=weabmp%> <%=texttCH%> 高<%=highV%>° 最低<%=lowV%>° |
感谢各位的阅读,以上就是“如何编写asp配合AJAX天气预报的webService”的内容了,经过本文的学习后,相信大家对如何编写asp配合AJAX天气预报的webService这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联网站建设公司,,小编将为大家推送更多相关知识点的文章,欢迎关注!