zoukankan      html  css  js  c++  java
  • js利用定时器动态改变层大小

    <html>
    <head>
        <title></title>
        <script type="text/javascript">
            function showDiv() {
                showIntervalId=setInterval("inc()", 100);
            }
            function inc() {
                var div1 = document.getElementById("div1");
                var oldwidth = div1.style.width;
                oldwidth = parseInt(oldwidth, 10);
                var oldheight = div1.style.height;
                oldheight = parseInt(oldheight, 10);
                if (oldwidth >= 200) {
                    clearInterval(showIntervalId);//停止计时器
                }
                oldwidth += 10;
                oldheight += 10;
                div1.style.width = oldwidth + "px";
                div1.style.height = oldheight + "px";
            }   
        </script>
    </head>
    <body>
    <div id="div1" style=" 10px;height:100px; border-style:solid; border-color:Red; border-1px;">
    中国人最爱上去找中国网站找不到资源的网站中国人最爱上去找中国网站找不到资源的网站
    中国人最爱上去找中国网站找不到资源的网站
    中国人最爱上去找中国网站找不到资源的网站
    </div>
    <input type="button" value="动态放大" onclick="showDiv()" />
    </body>
    </html>

  • 相关阅读:
    bzoj 4007
    bzoj 2190
    bzoj 2186
    bzoj 2005
    bzoj 2721
    bzoj 1951
    CF919F
    CF1005F
    CF1019C
    bitset用法详解
  • 原文地址:https://www.cnblogs.com/yichengbo/p/2178103.html
Copyright © 2011-2022 走看看