<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>获取天气信息</title>
<script language="javascript" src="jquery-1.8.2.min.js"></script>
<script language="javascript">
function getWeatherInfo() {
$.getScript("http://php.weather.sina.com.cn/js.php?" + $.param({
city : $("#position").val(), //城市
day : 0,
password : "DJOYnieT8234jlsK"
}) , function(json){
$("#weatherinfo").html('<img src="weather/'+ status1 +'.gif" style="vertical-align:middle;" /> <span style="vertical-align:middle;">'+temperature1+'°</span>');
});
}
</script>
</head>
<body>
<form>
<input type="text" id="position" />
<input type="button" onclick="getWeatherInfo()" value="提交" />
</form>
<div id="weatherinfo"></div>
</body>
</html>
评论5
最新资源