我只是想知道,如何才能将 iframe 加载延迟 5 秒?到目前为止我只知道html和css,没有时间,至少今年开始学习javascript。
无论如何,对于我正在开发的网站,我需要 iframe 在 5 秒后加载。任何帮助将不胜感激。
谢谢!
最佳答案
您将需要使用 Javascript,例如在您的 html 文件中:
<iframe id="myIframe"></iframe>
<script>
window.setTimeout(function () {
var iframe = document.getElementById('myIframe');
iframe.setAttribute('src', 'http://...');
}, 5000);
</script>
关于javascript - 如何延迟iframe的加载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33847775/