ASP.NET的实时天气及24小时天气预报(C#)

时间:2010-03-08 12:26:16  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:气预报         GetWeather.aspx   -----------------------------------      <%@ Page language="c#" Codebehind="GetWeather.aspx.cs" AutoEventWireup="false" Inherits="test.GetWeather" %>   <!DOCTYPE HTML...
  正文: ASP/ target=_blank class=infotextkey>asp.NET的实时天气及24小时天气预报(C#)
  修改其中的url获得其他城市的天气情况
  如广州为:
  http://weather.yahoo.com/forecast/CHXX0037_c.html
  注意仅适用于获得yahoo上的天气预报
  
  
  GetWeather.aspx
  -----------------------------------
  
  <%@ Page language="c#" Codebehind="GetWeather.aspx.cs" AutoEventWireup="false" Inherits="test.GetWeather" %>
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
  <HTML>
   <HEAD>
   <title>GetWeather</title>
   <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
   <meta name="CODE_LANGUAGE" Content="C#">
   <meta name="vs_defaultClientScript" content="JavaScript">
   <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
   </HEAD>
   <body>
   <form id="GetWeather" method="post" runat="server">
   <FONT face="宋体">
   <P>
   <asp:Label id="lblWeather" runat="server">Weather</asp:Label></P>
   <P>
   <asp:Button id="btnGet" runat="server" Text="Get Weather"></asp:Button></P>
   <P>
   <asp:Label id="Weather2" runat="server">24小时天气</asp:Label></P>
   <P>
   <asp:Button id="btnGet2" runat="server" Text="天气预报"></asp:Button></P>
   </FONT>
   </form>
   </body>
  </HTML>
  
  
  
  
  
  getWeather.aspx.cs
  ---------------------------------------
  
  using System;
  using System.Collections;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Web;
  using System.Web.SessionState;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Web.UI.HtmlControls;
  using System.Net;
  using System.IO;
  
  namespace test
  {
  
   public class GetWeather : System.Web.UI.Page
   {
   protected System.Web.UI.WebControls.Label lblWeather;
   protected System.Web.UI.WebControls.Label Weather2;
   protected System.Web.UI.WebControls.Button btnGet2;
   protected System.Web.UI.WebControls.Button btnGet;
  
   private void Page_Load(object sender, System.EventArgs e)
   {
   // Put user code to initialize the page here
   }
  
   #region Web Form Designer generated code
   override protected void OnInit(EventArgs e)
   {
   //
   // CODEGEN: This call is required by the ASP.NET Web Form Designer.
   //
   InitializeComponent();
   base.OnInit(e);
   }
  
   /// <summary>

"ASP.NET的实时天气及24小时天气预报(C#)"由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Programming/aspnet/13129.html


关键字:

关于《ASP.NET的实时天气及24小时天气预报(C#)》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td