我的情况是这样的:我们的首页是由动态页面生成的静态页面(index.aspx生成index.html)
但奇怪的是 index.aspx 是没有错误的,但是index.html 总是报
" missing } 位置:getDataByCity("zuixinshangjia", "/Ajax/Product/TagList.ashx?tagid=105&showtype=9"); //更新最新上架"
下面是代码:
<script language="javascript" type="text/javascript">
/*异步请求楼层数据等*/
function getDataByCity(conId, strUrl) {
$.ajax({
url: strUrl,
type: "post",
cache: false,
success: function (data) {
$("#" + conId).html("");
$("#" + conId).html("test 当前城市为:" + $("#currCity").html());
}
});
return false;
}
$(function () {
GetUserInfo();
GetCartNum();
/****最新产品等***/
getDataByCity("rexiaozhuanqu", "/Ajax/Product/TagList.ashx?tagid=105&showtype=9"); //更新热销专区
getDataByCity("zuixinshangjia", "/Ajax/Product/TagList.ashx?tagid=105&showtype=9"); //更新最新上架
getDataByCity("pinpaijingxuan", "/Ajax/Product/TagList.ashx?tagid=105&showtype=9"); //更新品牌精选
getDataByCity("cuxiaozhuanqu", "/Ajax/Product/TagList.ashx?tagid=105&showtype=9"); //更新促销专区
getDataByCity("meironghufu", "/Ajax/Product/TagList.ashx?tagid=105&showtype=4&cid=3"); //更新美容护肤
getDataByCity("shipinyinliao", "/Ajax/Product/TagList.ashx?tagid=105&showtype=4&cid=1"); //更新食品饮料
getDataByCity("shumajiadian", "/Ajax/Product/TagList.ashx?tagid=105&showtype=4&cid=5"); //更新数码家电
getDataByCity("muyingyongpin", "/Ajax/Product/TagList.ashx?tagid=105&showtype=4&cid=4"); //更新母婴用品
getDataByCity("jiajuriza", "/Ajax/Product/TagList.ashx?tagid=105&showtype=4&cid=203,206,207,209,211,212,213"); //更新家居日杂
getDataByCity("fuzhuangfushi", "/Ajax/Product/TagList.ashx?tagid=105&showtype=4&cid=8"); //更新服装服饰
});
</script>
最后才发现时:生成index.html 之后 所有的页面源码全部成了一行 而我有有注释符号“//最新热销专区” 因为代码全部都在一行了 就成了:
getDataCity("","")//更新热销专区........});
所有 });就被注释掉了
确实是缺少了}
在js 里 写注释最好不要用 // 用/**/ 比较好