当前位置: 代码迷 >> ASP.NET >> jquery的多功能树(单选 多选)动态加载 刷新 有关问题 ,js 天气预报 静态页面可以运行 直接拷到项目里就不运行了
  详细解决方案

jquery的多功能树(单选 多选)动态加载 刷新 有关问题 ,js 天气预报 静态页面可以运行 直接拷到项目里就不运行了

热度:1575   发布时间:2013-02-25 00:00:00.0
jquery的多功能树(单选 多选)动态加载 刷新 问题 ,js 天气预报 静态页面可以运行 直接拷到项目里就不运行了
1.jquery的多功能树(单选 多选)动态加载 刷新 问题 ,
2.js 天气预报 静态页面可以运行 直接拷到项目里就不运行了

1-1.这问题一直困扰我 我们项目组有一个 jquery的树 不过说还不够好。老大叫我在网上找一个更好更完善的。同行们 你们有什么好的嘛 给个能运行的demo吧。我也好研究哈 到时候 我会多多的给你们分的哦。
在这里我先谢谢你们了哈


2-1. 这是一个天气预报的 我有一个静态(纯js)页面 (除了在项目里)不管在哪里都能够运行 而且准确。现在头大了 放在项目里 json 那个东东不能正常运行。他们说可能是 存在iis 验证的问题。具体我也不知道 
在这里也请高人们指点啊



------解决方案--------------------------------------------------------
json你可能遇到的跨域问题;
我用 sina的api做了一个纯javascript的 天气预报:

<script type="text/javascript">
$(function () {
$("#imgw").hide();
var today = new Date().toDateString(); //每天更新一次,避免重复更新!
try {
$.getScript("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js", function (data) {
var city = remote_ip_info.city;
if (city == undefined || city == "") {
// $("#wea").hide();
// return;
city = "深圳"; //缺省地区
}

var url = "http://php.weather.sina.com.cn/iframe/index/w_cl.php?day=0&city=" + encodeURI(city) + "&today=" + today;
$.getScript(url, function () {

if (window.SWther) {
var img = "http://php.weather.sina.com.cn/images/yb3/78_78/" + window.SWther.w[city][0].f1 + "_1.png"
$("#imgw").attr("src", img).attr("title", window.SWther.w[city][0].s1 + " " + window.SWther.add.update);
$("#imgw").show("1000");
$("#ct")(city + ":");
$("#cw")(window.SWther.w[city][0].t2 + "℃~" + window.SWther.w[city][0].t1 + "℃");
$("#cs")(window.SWther.w[city][0].s1 + "~" + window.SWther.w[city][0].s2);
}
else {
$("#wea").hide();
}
});
});
}
catch (e) {
$("#wea").hide();
}
});
</script>
<div id="wea">
<div style="float:left;">
<img id="imgw" alt=""/>
<div style="margin-top:5px; float:right; line-height:normal;">
<b id="ct"></b><br />
<span id="cw"></span><br />
<span id="cs"></span><br />
</div>
</div>
  相关解决方案