显示标签属性

 

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #show{
            width:600px;
            height: 220px;
            background-color: darkseagreen;
            border: darkgreen 1px solid;
        }

    </style>
    <script src="js/jquery-1.11.3.min.js"></script>
    <script>
        $(function (){
           var text="";
           text += "DIV宽" + $("#show").width() + "<br>";

           text +=  "DIV高" +$("#show").height() + "<br>";
           $("#btn").click(function (){
               $("#show").html(text);
           })
        });
    </script>
</head>
<body>
    <div id="show"></div>
    <button id="btn">显示DIV的尺寸</button>
</body>
</html>

 

posted @ 2020-08-13 06:52  bingxingc  阅读(131)  评论(0编辑  收藏  举报