【发布时间】:2015-04-14 18:30:46
【问题描述】:
我正在将任意页面加载到元素中。但是,我只想在确定该页面已加载后才调用方法。有没有办法检测到这样的事件?
<body>
<div id="testFrame" style="width: 640px; height: 480px; border: solid; border-width: thick;"></div>
<input id="reload" type="button" value="Refresh"/>
<script>
$(document).ready(function(){
$('#reload').click(function(e){
e.preventDefault();
$("#testFrame").html('<object id="idObject" width="640" height="480"data="http://www.microsoft.com">');
});
$( "#idObject" ).isLoaded(function() { // Not a real function
alert("frame loaded"); // Show a message when the page is loaded
});
});
</script>
</body>
【问题讨论】:
-
通常ready函数就是这个..当一切都加载完毕
标签: javascript jquery