大家好,
我想请问为什么我的imgCount 如果在 $("div.panelArticle img").load(function() 外面就有值,但是在里面就永远 0的。我把它设成window.count也不能。我的count为什么永远都不能等于imgCount?
function checkImgLoaded(){
count=0;
imgCount = $("div.panelArticle img").length;
alert(imgCount); //这能实行而且有值
$("div.panelArticle img").load(function(){
alert(imgCount); //这行没能实行
count++;
if(count==imgCount){
equalHeight("leftPanel","content");
}
});
}谢谢大家
我想请问为什么我的imgCount 如果在 $("div.panelArticle img").load(function() 外面就有值,但是在里面就永远 0的。我把它设成window.count也不能。我的count为什么永远都不能等于imgCount?
function checkImgLoaded(){
count=0;
imgCount = $("div.panelArticle img").length;
alert(imgCount); //这能实行而且有值
$("div.panelArticle img").load(function(){
alert(imgCount); //这行没能实行
count++;
if(count==imgCount){
equalHeight("leftPanel","content");
}
});
}谢谢大家
解决方案 »
- window.prompt能否确定窗口大小
- js call()
- o = document.getElementsByName("aa")是得到一个数组,那么怎样清除这个数组的所有元素?
- 谁帮我匹备一下{$PicUrl}这个字符串
- js新手,求大神解答。下面的代码有什么问题,为什么搜索出来不是用户输入的值,而是x
- 这个问题怎么解决?有一件事件没有响应?
- 请问用JavaScript语言能在窗体中关闭另一个窗体吗?如能,怎样?
- 如何获的要显示信息的长度呢?
- 一边打字,一边吐血.......
- 求助,如何把::-webkit-scrollbar换成js怎么写呢?
- Ext4.0做图的高手来!请教个问题
- 复杂的图表绘制,各位帮忙看看!
你好,
我在我的函数下面还有一个:
imgCount = $("div.dataRepeater img").length; //里面没有img所以是0
为什么它不是执行我的上面的load后再执行下面的代码?
谢谢
LOAD执行早。在那时还没有后面的结果,当然为0.