• 2010-07-13

    动态开关banner的js代码(兼容ie&ff&op) - [技术空间]

    版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
    http://www.blogbus.com/lily64-logs/69194835.html

    写了个动态开关的banner,代码存档。
    <script>
    function myclose()
    {
    document.getElementByIdx_x_x_x("mylabel").style.display='none';
    }
    function myhidden()
    {
    document.getElementByIdx_x_x_x("mylabel").style.height=document.getElementByIdx_x_x_x("mylabel").offsetHeight-1+"px";
    if(document.getElementByIdx_x_x_x("mylabel").offsetHeight>1)
    setTimeout(myhidden,10);
    else
    setTimeout(myclose,10);
    }
    function myshow()
    {
    document.getElementByIdx_x_x_x("mylabel").style.height=document.getElementByIdx_x_x_x("mylabel").offsetHeight+1+"px";
    if(document.getElementByIdx_x_x_x("mylabel").offsetHeight<108)
    setTimeout(myshow,10);
    else
    setTimeout(myhidden,8000);
    }
    function showlabel()
    {
    document.getElementByIdx_x_x_x("mylabel").style.display='block';
    setTimeout(myshow,10);
    }
    window.onload=showlabel;
    </script>
    <div id=mylabel style="display:none;overflow:hidden;height:1px">
    <a href=""><img src="micro_banner.jpg" /></a>
    </div>
    <div>
    <p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p>
    <p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p>
    <p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p>
    <p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p><p>ballack</p>
    </div>

    分享到:

    历史上的今天: