我的电脑上有天气状况的图标
我想通过我的图标更改默认图标我该怎么办
在 json 文件中有变量,例如:“icon”:“partlycloudy”
<html>
<head>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<body>
<img id='wicon'><img>
<script>
jQuery(document).ready(function($) {
var state = 'CA';
var city = 'San_Francisco';
var URL = 'http://api.wunderground.com/api/102376e7c0e1c995/geolookup/conditions/q/' + state + '/' + city + '.json';
$.ajax({ url : URL,
dataType : "jsonp",
success : function(parsed_json) {
var location = parsed_json['current_observation']['display_location']['full'];
var temp = parsed_json['current_observation']['temperature_string'];
var wicon = parsed_json['current_observation']['icon_url'];
</script>
</body>
</head>
</html>
我想通过像这样在链接中添加变量来更改天气状况图标
http://icons-ak.wxug.com/i/c/k/ '; + 图标变量 + '.gif
jQuery(document).ready(function($) {
var state = 'CA';
var city = 'San_Francisco';
var URL = 'http://api.wunderground.com/api/102376e7c0e1c995/geolookup/conditions/q/' + state + '/' + city + '.json';
$.ajax({ url : URL,
dataType : "jsonp",
success : function(parsed_json) {
var location = parsed_json['current_observation']['display_location']['full'];
var temp = parsed_json['current_observation']['temperature_string'];
var wicon = parsed_json['current_observation']['icon_url'];
var humidity = parsed_json['current_observation']['relative_humidity'];
var wind = parsed_json['current_observation']['wind_string'];
var pressure = parsed_json['current_observation']['pressure_mb'];
var visibility = parsed_json['current_observation']['visibility_km'];
var weicon = parsed_json['current_observation']['icon'];
$("#meteo").text(temp);
$( '<img>' ).attr( 'src', wicon ).appendTo( '#wicon' );
$("#location").text(location);
$("#humidity").text(humidity);
$("#wind").text(wind);
$("#pressure").text(pressure);
$("#visibility").text(visibility);
} }); });
var wicon 是天气图标的链接,var weicon 是图标的名称
请帮忙