一、 setTimeout this指向問題
setTimeout("this.count()",1000)中的this指的是window對象.
js的setTimeout定義為
復制代碼 代碼如下:
window.setTimeout=function(vCode, iMilliSeconds [, sLanguage]){
//.....代碼
return timer//返回一個標記符
}
復制代碼 代碼如下:
function init(){
var url = "<%=basePath%>fetchwater.do?method=searchRealWater&xzqh=" + "<%=xzqh%>" + "&rand="+Math.random();
//alert(url);
window.setTimeout(function(){ searchJDWater(url);},100);
}
新聞熱點
疑難解答
圖片精選