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>
posted on 2009-09-10 14:17  念时  阅读(476)  评论(0编辑  收藏  举报

细节决定成败!态度决定一切!