我要投稿
  • 您当前的位置:中国教育资源网 -> 技术教程 -> 网站建设教程 -> 源码精华 -> 教程内容
  • [ 收藏本页教程 ]
  • 自动判断所在城市的天气源码精华教程

    教程作者:佚名    教程来源:不详   教程栏目:源码精华    收藏本页
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">

    <title>天气预报</title>
    <style type="text/css">
    <!--
    body {
    margin: 0px;
    background-color: F4F4F4;
    }
    .f14b {
    font-size: 12px;
    font-weight: bold;
    color: #333333;
    }
    .f12orange {
    font-size: 12px;
    color: #ff6600;
    }
    .f2blue {
    font-size: 12px;
    color: #333333;
    }
    .f12blue2 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #0066cc;
    }
    .f12red {
    font-size: 12px;
    color: #ff6600;
    font-family: Arial, Helvetica, sans-serif;
    }
    .f2black {
    font-size: 12px;
    color: #000000;
    }
    -->
    </style>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    var openW;

    function openWindow(theURL,winName,features) { //v2.0
    //openW=window.open(theURL,winName,features);
    //var mxh2 = window.open("about:blank","window_mxh")
    //var mxh2 =window.open(theURL,winName,features);
    window.showModalDialog(theURL,test(),'dialogHeight:270px;dialogWidth:265px;scroll:no;status:no')
    }
    function test(){
    location.href="index.htm";

    }
    //-->
    </script>

    <script language="javascript" id="objscript"></script>
    <script language="JavaScript" type="text/JavaScript" src="http://www.116.com.cn/116/home/weather/public.js"></script>
    <script language="JavaScript" type="text/JavaScript" src="http://www.116.com.cn/116/home/weather/weather.js"></script>
    <script language="JavaScript" type="text/JavaScript" src="http://jsp.116.com.cn/notice/iptocityid.jsp"></script>
    <script language="JavaScript">


    var locid;
    var cityname;
    var defid;

    if(getCookie("defid")=='')
    {
    locid=CityID;


    setCookie("defid",CityID);

    }else
    {
    locid=getCookie("defid");

    }
    var havecheck;
    if(getCookie("check")==''){
    havecheck='2';
    }else{
    havecheck=getCookie("check");
    }
    var show;
    if(havecheck=='0'){
    locid=getCookie("CityID");

    show=0;
    }else {
    locid=getCookie("defid");

    show=1;
    }

    var urlstr = "http://jsp.116.com.cn/weather/"+locid+".js";

    document.all["objscript"].src = urlstr;
    //var oWea = new makeWeatherObj();

    </script>

    </head>
    <body topmargin="0" leftmargin="0">
    <SCRIPT language="javascript">
    var oWea = new makeWeatherObj();
    </script>
    <table width="160" height="100" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td width="160" height="40" valign="bottom" class="f14b"><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td align="center" class="f14b">您所在的城市:<font color="#ff6600">
    <SCRIPT language="javascript">
    document.write(oWea.swName);
    </script></font>
    </td>
    </tr>
    <tr>
    <td height="15"></td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <form name="form1" method="post" action="">
    <td width="160" height="60" align="center" valign="top">
    <table width="150" border="0" cellspacing="0" cellpadding="0">
    <tr align="center" valign="bottom">
    <td width="50" height="15" class="f12orange">今天</td>
    <td width="50" class="f2blue">明天</td>
    <td width="50" class="f2blue">后天</td>
    </tr>
    <tr align="center">
    <td height="25"><SCRIPT language="javascript">
    var weather24=oWea.swWeather24.split("-");
    document.write("<img src=http://www.zbzn.com/qxyb/images/weather/icons/"+transTab(weather24[0])+"_small.gifborder='0'>");
    if(weather24.length==2) document.write("<img src=http://www.zbzn.com/qxyb/images/weather/icons/"+transTab(weather24[1])+"_small.gifborder='0'>");
    </script></td>
    <td><SCRIPT language="javascript">
    var weather48=oWea.swWeather48.split("-");
    document.write("<img src=http://www.zbzn.com/qxyb/images/weather/icons/"+transTab(weather48[0])+"_small.gifborder='0'>");
    if(weather48.length==2) document.write("<img src=http://www.zbzn.com/qxyb/images/weather/icons/"+transTab(weather48[1])+"_small.gifborder='0'>");
    </script></td>
    <td><SCRIPT language="javascript">
    var weather72=oWea.swWeather72.split("-");
    document.write("<img src=http://www.zbzn.com/qxyb/images/weather/icons/"+transTab(weather72[0])+"_small.gifborder='0'>");
    if(weather72.length==2) document.write("<img src=http://www.zbzn.com/qxyb/images/weather/icons/"+transTab(weather72[1])+"_small.gif border='0'>");
    </script></td>
    </tr>
    <tr align="center">
    <td><SCRIPT language="javascript">
    var wendu=oWea.swWendu24.split("-");
    document.write("<span class='f12blue2'>"+wendu[0]+"</span>");
    </script></td>
    <td height="20"><SCRIPT language="javascript">
    我要投稿   -   广告合作   -   关于本站   -   友情连接   -   网站地图   -   联系我们   -   版权声明   -   设为首页   -   加入收藏   -   网站留言
    Copyright © 2009 - 20012 www.chinesejy.com All Rights Reserved.中国教育资源网 版权所有