码迷,mamicode.com
首页 > 其他好文 > 详细

clientWidth--用法

时间:2015-12-09 18:56:13      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
    *{
        margin: 0;
        padding: 0;
        /*box-sizing: border-box;*/
    }
    .a{
        width: 100px;
        height: 100px;
        background-color: red;
        /*margin:30px;*/
        padding: 30px;
        border:30px solid #969696;
    }
    </style>
</head>
<body>

<section id = ‘s‘class="a"></section>


<script type="text/javascript">
    alert(‘clientWidth:‘+document.getElementById("s").clientWidth);
    alert(‘clientHeight:‘+document.getElementById("s").clientHeight);
    alert(‘offsetWidth:‘+document.getElementById("s").offsetWidth);
    alert(‘offsetHeight:‘+document.getElementById("s").offsetHeight);
    alert(‘scrollWidth:‘+document.getElementById("s").scrollWidth);
    alert(‘scrollHeight:‘+document.getElementById("s").scrollHeight);
    alert(‘scrollTop:‘+document.getElementById("s").scrollTop);
    alert(‘scrollLeft:‘+document.getElementById("s").scrollLeft);
    alert(‘screenTop:‘+window.screenTop);
    alert(‘screenLeft:‘+window.screenLeft);
    alert(‘screen.height:‘+window.screen.height);
    alert(‘screen.width:‘+window.screen.width);
    alert(‘screen.availHeight:‘+window.screen.availHeight);
    alert(‘screen.availWidth:‘+window.screen.availWidth);
</script>
</body>
</html>

 

clientWidth--用法

标签:

原文地址:http://www.cnblogs.com/rysly/p/clientWidth_usage.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!