我想知道如何修改此代码,以便在该功能激活之前有2秒的延迟:

<script type="text/javascript">
function iframe_onload()
{
var theWaitCell = document.getElementById('Wait1');
theWaitCell.style.display = "none";
}
</script>


任何帮助,将不胜感激,

谢谢!

最佳答案

function iframe_onload()
{
    var timer = setTimeout(function() {
        var theWaitCell = document.getElementById('Wait1');
        theWaitCell.style.display = "none";
    }, 2000);
}

10-08 16:46