JavaScript复习--点击按钮,div边框(宽和高)动态增加

 <script type="text/javascript">
        var setinterval;
        function showInc()
        {
            setinterval = setInterval("add()",100);
        }

        function add()
        {
            var ddd = document.getElementById("divv");
            var width = parseInt(ddd.style.width,10);
            var height = parseInt(ddd.style.height, 10);
            width = width + 10;
            height = height + 10;
            if (width>500) {
                clearInterval(setinterval);
            }
            ddd.style.width = width + "px";
            ddd.style.height = height + "px";
        }
    </script>
</head>
<body>
    <div id="divv" style="border:1px solid #0d0c0c;width:200px;height:200px">
        画鸡
        <table>
            <tr>
                <td>头上红冠不用彩,</td>
            </tr>
              <tr>
                <td>满身雪白走将来。</td>
            </tr>
             <tr>
                <td>平生不敢轻言语,</td>
            </tr>
              <tr>
                <td> 一叫千门万户开。</td>
            </tr>
        </table>
    </div>
      <input type="button" value="动态增加"  onclick="showInc();"/>
</body>

JavaScript复习--点击按钮,div边框(宽和高)动态增加,布布扣,bubuko.com

JavaScript复习--点击按钮,div边框(宽和高)动态增加

上一篇:python


下一篇:【C/C++教学专题之012】从Hello World开始