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>

  • 相关阅读:
    【JEECG技术文档】JEECG online 表单填值规则使用说明
    【JEECG技术文档】JEECG 接口权限开发及配置使用说明
    【JEECG技术文档】JEECG 组织机构导入V3.7
    【JEECG技术文档】Online唯一校验使用说明
    h5 文件下载
    babel (三) babel polly-fill
    babel (二) update to v7
    babel(一)
    noode inquirer
    node path
  • 原文地址:https://www.cnblogs.com/yichengbo/p/2178103.html
Copyright © 2011-2022 走看看