获取客户端天气

以下代码直接运行即可

 

 


<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<script type="text/javascript"

src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://mj.588cy.com/img/weather_mj.js"

language="javascript"charset="UTF-8"></script>
<script type="text/javascript">
//创建天气预报核心对象
var weather_=new weather();
var city = "";
$(document).ready(function(){
$.getScript('http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js',function(){
city=remote_ip_info.city;
jintian();
$(".city").html(remote_ip_info.city);
 })
});
</script>
<style type="text/css">
.city{}
.weather{ float:left; color:#333333; padding:10px 10px 10px 20px;}
.weather a{ color:#333333;}
.wt{line-height:17px; font-size:12px; float:left; padding:3px 5px; text-align:center;}
.wtimg{ vertical-align:middle;padding:0px 1px; margin:0PX auto;}
</style>
</head>
<body>
<div style="text-align:center;">当前城市:<span class="city"></span></div>
<div class="weather" style="margin-left:0px;">
<div class="wtimg" id="T_weather_img"></div>
<div class="wt">今 天<br /><span id="T_weather"></span><br /><span

id="T_temperature"></span><br/><span id="T_direction"></span><br/><span

id="T_wind"></span></div>
</div>
<div class="weather">
<div class="wtimg" id="M_weather_img"></div>
<div class="wt">明 天<br /><span id="M_weather"></span><br /><span

id="M_temperature"></span><br/><span id="M_direction"></span><br/><span

id="M_wind"></span></div>
</div>
</div>
</body>
</html>

 

这个要比带百度接口的天气  好控制。 各种样式有自己设置 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值