JS获取任意位置的Div,通过TryCatch和Settimeout实现。

<div>
<!--Power by -->
<script>
    var nst;
    function nsfun()
    {
    try
    {
    document.getElementById("rightinfo").innerHTML = "<p>Powered by <b><a href='http://www.2conline.cn' >2C在线</a></b></p><p>&copy;2001-2009  <a href='http://www.2conline.cn' >www.2conline.cn</a></p>";

clearTimeout(nst);

    }
    catch(err)
    {
    nst=setTimeout(nsfun,100);
    }
    }
    nsfun();

</script>
</div>

你可能感兴趣的:(settimeout)