发布网友
共3个回答
热心网友
你最好把全文贴出来 这样看不出来 你2个函数引用时是怎么个情形
按道理来说 clearInterval(updateheight)是无效的 如果updateheight真的是局部的话,不过不是没特殊情况 要看代码才知道
热心网友
updateheigth 只能在updateHeight() 这个Function里有用。
只能定义全局
var updateheight;
function updateHeight(){
updateheight = setInterval(function(){
if (objload) {
obj.adjustHeight();
clearInterval(updateheight);
}
}
, 1000);
}
回答完了才看到问题的最后一句话。=。=。
还是提交了。
热心网友
对了, updateheight 的作用域只限于函数内.
var updateheight ;
function updateHeight(){
updateheight = setInterval('adjustHeight()', 1000);
}
这样就可以了
提醒一下: 变量名和函数名太相似了, 千万别看错了