use*_*736 17 html javascript iframe
任何人都可以告诉我如何检测iframe是否已完成加载所以我可以调用一个javascript函数并提醒用户iframe已完成加载并在javascript函数中执行其他一些过程?(注意我的iframe是我自己的网站)我可以从iframe中解除回调,因为我可以控制它吗?如果有,怎么样?
<iframe id ='myframe' src='http://www.example.com/doit.php'></iframe>
Run Code Online (Sandbox Code Playgroud)
pba*_*ris 38
试试这个
<iframe id ='myframe' src='http://www.mysite.com/doit.php' onload="onLoadHandler();"></iframe>
<script type="text/javascript">
function onLoadHandler() {
alert('loaded');
}
</script>
Run Code Online (Sandbox Code Playgroud)
Joh*_*nde 12
像处理任何东西一样处理它:
$('#myframe').on('load', function() {
// Handler for "load" called.
});
Run Code Online (Sandbox Code Playgroud)
过时的答案:
$('#myframe').load(function() {
// Handler for .load() called.
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
52110 次 |
最近记录: |