jQuery onload函数 [英] jQuery onload function
本文介绍了jQuery onload函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下脚本来调用onload函数,但在IE中不起作用
I m using the following script to call a onload function but it does not works in IE
("#body").attr({onload : "calFact();"});
推荐答案
如果您使用的是jQuery,则可以使用 ready()
的功能如下:
If you are using jQuery you could use the ready()
function like so:
$(function() {
callFact();
});
或更简单地说,只需将方法传递给jQuery:
or even more simply, just pass the method to jQuery:
$(callFact);
这将在DOM可用时立即触发,有时早于onload
.
That will fire as soon as the DOM is available to manipulate, sometimes earlier than onload
.
这篇关于jQuery onload函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文