首页 > 其他 > 详细

clientWidth--用法

时间:2015-12-09 18:53:41      阅读:178      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!