Iframe:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第40行: 第40行:
<syntaxhighlight lang="html">
<syntaxhighlight lang="html">
<script>
<script>
const onHandleLoad = () => console.log('iframe is loaded');
  const onHandleLoad = () => console.log('iframe is loaded');
</script>
</script>
<iframe id="iframe" src="https://kangkk.com" onload="onHandleLoad(this)"></iframe></syntaxhighlight>
<iframe id="iframe" src="https://kangkk.com" onload="onHandleLoad(this)"></iframe></syntaxhighlight>
第47行: 第47行:
<syntaxhighlight lang="html">
<syntaxhighlight lang="html">
<script>
<script>
document.getElementById('iframe').onload = () => console.log('iframe is loaded');
  document.getElementById('iframe').onload = () => console.log('iframe is loaded');
</script>
</script>
<iframe id="iframe" src="https://kangkk.com"></iframe></syntaxhighlight>
<iframe id="iframe" src="https://kangkk.com"></iframe></syntaxhighlight>
第54行: 第54行:
<syntaxhighlight lang="html">
<syntaxhighlight lang="html">
<script>
<script>
const iframe = document.getElementById('iframe');
  const iframe = document.getElementById('iframe');
const onHandleLoad = () => console.log('iframe is loaded');
  const onHandleLoad = () => console.log('iframe is loaded');
iframe.addEventListener('load', onHandleLoad, true);
  iframe.addEventListener('load', onHandleLoad, true);
</script>
</script>
<iframe id="iframe" src="https://kangkk.com"></iframe></syntaxhighlight>
<iframe id="iframe" src="https://kangkk.com"></iframe></syntaxhighlight>