如何在ASP网页中加入一个天气预报链接?

xiaosong2008 2007-05-28 05:46:36
我想在我的ASP网页中调用一个天气预报,显示本地的天气预报信息,该如何实现?
我查阅了以前的资料,链接大都无法可用,有一个可用,可是太不准了,我想调用比较准确的比如中央气象台,或滕讯的等,该如何实现呢?
...全文
2231 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
kevinsum 2007-05-29
  • 打赏
  • 举报
回复
<iframe src="http://www.tianqi123.com/php/current_city.php?c0=F9DC68&c1=white&c2=FEFCE0&t1=red&bg=white&w=178&text=no" width=178 height=110 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no align=center id=url></iframe>

用这个吧~~~

直接IFRAME
windflow 2007-05-29
  • 打赏
  • 举报
回复
用我的吧,http://cnya10.com/blog/article.asp?id=44
最近刚完成的,返回XML数据,你可以很灵活的在前端处理
beyondjsq 2007-05-29
  • 打赏
  • 举报
回复
Function GetWeatherHTML()
Dim XmlDoc,XmlList,tempData,xmlData,MaxTemperature,MinTemperature,WeatherICO,tempNum,tempDate
Set XmlDoc = Server.CreateObject("Msxml.DOMDocument")
XmlDoc.async = false
XmlDoc.setProperty "ServerHTTPRequest", true
GetWeatherHTML = ""
if xmlDoc.load(WeatherFile) then
Set XmlList = xmlDoc.selectSingleNode("//dayf")
if not isNull(XmlList) then
if XmlList.childNodes.item(0).nodeName="lsup" then

tempData = XmlList.childNodes.item(0).text

tempNum = instr(1,tempData,"/")
tempDate = left(tempData,tempNum-1) & "月"
tempData = mid(tempData,tempNum+1)

tempNum = instr(1,tempData,"/")
tempDate = tempDate & left(tempData,tempNum-1) & "日"
tempData = mid(tempData,tempNum+1)

tempNum = instr(1,tempData," ")
tempDate = left(tempData,tempNum-1) & "年" & tempDate


if isDate(tempDate) then

if DateDiff("d",CDate(tempDate),now())=0 then
For i=1 To XmlList.childNodes.length
if XmlList.childNodes.item(i).nodeName="day" then
if XmlList.childNodes.item(i).getAttribute("d")="0" then
Set xmlData = XmlList.childNodes.item(i).childNodes
if not isNull(xmlData) then
MaxTemperature = xmlData.item(0).text
if IsNumeric(MaxTemperature) Then
MaxTemperature = (Clng(MaxTemperature)-32)*5\9
end if
MinTemperature = xmlData.item(1).text
if IsNumeric(MinTemperature) Then
MinTemperature = (Clng(MinTemperature)-32)*5\9
end if
WeatherICO = xmlData.item(4).childNodes.item(0).text
GetWeatherHTML = "<br><br><table width=" & 140 + MarginWidth & "><tr><td align=center>天气情况</td><td align=center>最低温度</td><td align=center>最高温度</td></tr><tr><td align=center><img src=""/PublicFunction/Weather/" & WeatherICO & ".gif"" border=0 align=absbottom></td><td align=center>" & MinTemperature & "℃</td><td align=center>" & MaxTemperature & "℃</td></tr></table>"
end if
Exit For
end if
end if
next
end if
end if
end if
end if
end if
end Function

'获取天气预报
Set fso = CreateObject("Scripting.FileSystemObject")
WeatherFile = Server.MapPath("/User_Data/Weather.XML")
if Not fso.FileExists(WeatherFile) Then
GetWeatherXML()
End If
if fso.FileExists(WeatherFile) Then
tempData = GetWeatherHTML()
if tempData="" Then
GetWeatherXML()
tempData = GetWeatherHTML()
end if
Response.Write tempData
end if
BoyHaXin 2007-05-29
  • 打赏
  • 举报
回复
subasan 2007-05-28
  • 打赏
  • 举报
回复
<!--此特效来源来互联网,由 kudaa.com 收集整理-->
<!--网页天气预报代码大全-->
<P>考虑到平时会用到各种形式的天气显示形式,所以将平时在网上搜集的和自己整理的天气代码放在这里 供参考(由于大部分效果使用的是框架调用别人的代码,所以当别人的网站修改了代码的时候有的效果可 能显示不出来需要到相关网站查看修改):</P>
<P><STRONG>名称</STRONG>:<FONT color=#ff0000>265天气根据IP自动获得当地的天气情况</FONT><BR><STRONG>代码</STRONG>:<iframe src="<A href="http://weather.265.com/weather.htm">http://weather.265.com/weather.htm</A>" width="168" height="54" frameborder="no" border="0" marginwidth="0&quoat; marginheight="0" scrolling="no"></iframe><BR><STRONG>效果</STRONG>:<BR><IFRAME border=0 marginWidth=0 marginHeight=0 src="http://weather.265.com/weather.htm" frameBorder=no width=168 scrolling=no height=54></IFRAME><BR><BR><STRONG>说明 </STRONG>:直接调用<BR></P><BR>
<P><STRONG>名称</STRONG>:<FONT color=#ff0000>QQ天气预报代码(一)</FONT><BR><STRONG>代码 </STRONG>:<iframe width="145" height="130" border="0" align="center" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" src="<A href="http://minisite.qq.com/Weather/news_new.html">http://minisite.qq.com/Weather/news_new.h tml</A>" allowTransparency="true"></iframe><BR><STRONG>效果 </STRONG>:<BR><IFRAME border=0 align=center marginWidth=0 marginHeight=0 src="http://minisite.qq.com/Weather/news_new.html" frameBorder=0 width=145 scrolling=no height=130 allowTransparency></IFRAME><BR><BR><STRONG>说明 </STRONG>:这种适合于在网页的边栏插入。但一个缺点是,上面的4个城市是既定的,无法改成别的。插 入时,选好网页上的位置,直接将左栏的源代码全部拷进去就行了<BR></P><BR>
<P><STRONG>名称</STRONG>:<FONT color=#ff0000>QQ天气预报代码(二)</FONT><BR><STRONG>代码 </STRONG>:<IFRAME ID='ifm2' WIDTH='189' HEIGHT='190' ALIGN='CENTER' MARGINWIDTH='0' MARGINHEIGHT='0' HSPACE='0' VSPACE='0' FRAMEBORDER='0' SCROLLING='NO' SRC='http://weather.qq.com/inc/ss258.htm'></IFRAME><BR><STRONG>效果 </STRONG>:<BR><IFRAME id=ifm2 align=center marginWidth=0 marginHeight=0 src="http://weather.qq.com/inc/ss258.htm" frameBorder=0 width=189 scrolling=no height=190></IFRAME><BR><BR><STRONG>说明 </STRONG>:这种 也适合于在网页的边栏插入。上面 的城市可以自定,比如厦门可改成别的。定制的方法是修改我代码中标红的数字,从1开始代表“香 港”开始,每个数字都代表一个城市,厦门是287,具体要哪个城市自己找一下罢。<BR></P><BR>
<P><STRONG>名称</STRONG>:<FONT color=#ff0000>新浪天气预报代码</FONT><BR><STRONG>代码 </STRONG>:<IFRAME ID='ifm2' WIDTH='260' HEIGHT='70' ALIGN='CENTER' MARGINWIDTH='0' MARGINHEIGHT='0' HSPACE='0' VSPACE='0' FRAMEBORDER='0' SCROLLING='NO' src="<A href='http://news.sina.com.cn/iframe/weather/130101.html"></iframe'>http://news.sina.com.cn/iframe/weather/130101.html"></iframe</A>><BR><STRONG>效果 </STRONG>:<BR><IFRAME id=ifm2 align=center marginWidth=0 marginHeight=0 src="http://news.sina.com.cn/iframe/weather/130101.html" frameBorder=0 width=260 scrolling=no height=70></IFRAME><BR><BR><STRONG>说明 </STRONG>:这种适合于在网页的头栏插入。上面的城市可以自定,比如 石家庄可改成别的。<BR></P><BR>
<P><STRONG>名称</STRONG>:<FONT color=#ff0000>QQ天气预报代码(三)</FONT><BR><STRONG>代码 </STRONG>:<iframe width="469" height="218" border="0" align="center" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" src="<A href="http://appnews.qq.com/cgi-bin/news_weather_search?city">http://appnews.qq.com/cgi-bin/news_weather_search?city</A>=厦门" allowTransparency="true"></iframe><BR><STRONG>效果 </STRONG>:<BR><IFRAME border=0 align=center marginWidth=0 marginHeight=0 src="http://appnews.qq.com/cgi-bin/news_weather_search?city=厦门" frameBorder=0 width=469 scrolling=no height=218 allowTransparency></IFRAME><BR><BR><STRONG>说明 </STRONG>:这种适合于在网页的正栏插入。上面的城市可以自定,比如厦门可改成别的。定制的方法是修改我代码中标红的 名称。这里比较简单,直接用汉字改就行了。比如是福州的,你就直接把“厦门”改成福州就行。<BR></P><BR>
<P><STRONG>名称</STRONG>:<FONT color=#ff0000>QQ天气预报代码(四)</FONT><BR><STRONG>代码 </STRONG>:<iframe width=160 height=230 frameborder=0 scrolling=NO src=http://appnews.qq.com/cgi-bin/news_qq_search?city=南昌></iframe><BR><STRONG>效果 </STRONG>:<BR><IFRAME id=ifm1 align=center marginWidth=0 marginHeight=0 src="http://weather.qq.com/24.htm" frameBorder=0 width=405 scrolling=no height=332></IFRAME><BR><BR><STRONG>说明 </STRONG>:直接调用<BR></P><BR>
<P><STRONG>名称</STRONG>:<FONT color=#ff0000>QQ天气预报代码(五)</FONT><BR><STRONG>代码 </STRONG>:<iframe src="<A href="http://appnews.qq.com/cgi-bin/news_qq_search?city">http://appnews.qq.com/cgi-bin/news_qq_search?city</A>=南昌" frameborder="0" width="160" scrolling="no" height="230"></iframe><BR><STRONG>效果 </STRONG>:<BR><IFRAME src="http://appnews.qq.com/cgi-bin/news_qq_search?city=南昌" frameBorder=0 width=160 scrolling=no height=230></IFRAME><BR><BR><STRONG>说明 </STRONG>:这种适合于在网页的边栏插入。上面的城市可以自定,比如南昌可改成别的。定制的方法是修改我代码中标红的名称。这里比较简单,直接用汉字改就行了。比如是福州的,你就直接把“厦门”改成福州就行<BR></P>
<P><BR></P>
</DIV>





来自 http://www.kudaa.com
第1章 登录验证模块 1 1.1 开发站点前的配置 1 1.1.1 创建Web站点 1 1.1.2 使用站点安全工具配置身份验证模式 2 1.1.3 配置站点的数据存储方式 4 1.1.4 定制自己的数据存储方式 4 1.2 最普通的登录方式 6 1.2.1 用户注册功能 6 1.2.2 用户的登录功能 7 1.2.3 修改密码功能 8 1.2.4 在登录页面添加注册导航功能 8 1.2.5 显示登录用户名和用户状态功能 8 1.2.6 根据用户登录身份显示不同效果页功能 9 1.3 基于角色的登录方式 10 1.3.1 在应用程序启用角色 10 1.3.2 创建角色 10 1.3.3 创建角色访问规则 11 1.3.4 赋予用户角色权限 11 1.3.5 验证角色的登录 12 1.4 匿名用户的授权管理 12 1.5 小结 13 第2章 缓存管理模块 14 2.1 数据库缓存依赖的优点 14 2.2 开始使用缓存 15 2.2.1 开启应用程序的缓存功能 15 2.2.2 配置缓存依赖的数据库 15 2.2.3 为SQL Server启用缓存通知 16 2.3 控件级数据缓存功能 16 2.3.1 添加时间戳和数据 16 2.3.2 观察缓存数据的变化 18 2.4 页面级数据缓存依赖功能 18 2.4.1 配置页面的缓存属性 18 2.4.2 完善模块两个功能的导航 19 2.5 小结 20 第3章 个性化设置模块 21 3.1 简单类型的个性化设置功能 21 3.1.1 设置个性化的项目 21 3.1.2 配置个性化信息 22 3.1.3 个性化用户登录站点 22 3.1.4 保存个性化设置 22 3.1.5 显示个性化设置 23 3.2 复杂类型的个性化设置功能 23 3.2.1 设计复杂个性化的项目 24 3.2.2 配置复杂项目 25 3.2.3 保存复杂项目的设置 25 3.2.4 获取复杂项目的设置并显示 26 3.3 匿名用户的个性化设置功能 27 3.3.1 启用匿名用户的个人配置属性 28 3.3.2 设计匿名用户的登录功能 28 3.3.3 将匿名用户的个性化设置移植到已验证用户 30 3.4 完善系统对3个功能的导航 31 3.5 小结 31 第4章 投票模块 32 4.1 一个简单的投票系统 32 4.1.1 设计投票功能的数据存储方式 32 4.1.2 投票项目管理功能 33 4.1.3 投票功能 37 4.1.4 图形化显示投票结果功能 38 4.2 防止重复投票技术 40 4.2.1 利用Session对象 40 4.2.2 利用Cookies对象 41 4.2.3 验证IP和登录时间 41 4.2.4 小范围调查 42 4.3 一个完整的投票系统 42 4.3.1 投票系统的功能模块 42 4.3.2 投票系统的数据库架构 43 4.3.3 数据库数据之间的关系 43 4.3.4 投票主题管理 44 4.3.5 投票项目管理 52 4.3.6 投票功能管理 54 4.3.7 投票系统后台权限管理 59 4.4 小结 60 第5章 RSS模块 61 5.1 RSS的定义 61 5.2 RSS的作用 61 5.3 RSS的订阅原理 62 5.3.1 RSS的工作原理 62 5.3.2 RSS订阅工具的使用 63 5.4 在网站内加入RSS功能 65 5.4.1 使用Microsoft提供的RSS工具包 65 5.4.2 一个简单的RSS阅读器 66 5.4.3 一个复杂的RSS阅读器 67 5.4.4 让站点提供订阅功能 69 5.5 小结 70 第6章 在线编辑模块 71 6.1 在线编辑的原理 71 6.2 编辑器的界面 71 6.3 一个简单的在线编辑器 72 6.3.1 在线编辑窗口的界面设计 72 6.3.2 在线编辑的功能实现 73 6.3.3 在线编辑的运行效果 74 6.4 多功能在线编辑器的介绍 74 6.4.1 FreeTextBox编辑器 74 6.4.2 FCKEditor在线编辑器 76 6.5 小结 79 第7章 在线支付模块 80 7.1 在线支付介绍 80 7.1.1 在线支付的安全保障 80 7.1.2 在线支付的优点 80 7.2 在线支付的流程 81 7.3 使用支付宝实现在线支付 81 7.3.1 支付宝接口概述 81 7.3.2 支付宝接口服务下载 81 7.4 使用支付宝实现在线支付的实例 82 7.4.1 在项目加入支付宝程序 82 7.4.2 设计订单提交功能 82 7.4.3 获取支付成功后的返回信息 84 7.4.4 设置支付过程的通知 88 7.4.5 实现订单到支付宝的提交 90 7.5 小结 92 第8章 电子邮件模块 93

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧