Hello everybody:
I want to get the maximum height of the web browser, but I got some confusion in W3C DTD HTML 4.01 and // W3C // DTC XHTML 1.0 , below is my detailed information:
If I use W3C DTD HTML 4.01 at the top of the page title and use document.body.clientHeight , then I cannot get the full height of the browser:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test jQuery Height</title>
<script type="text/javascript" src="../lib/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
$(function(){
var height=document.body.clientHeight;
alert(height);
})
</script>
</head>
<body>
<div style="margin-left:30px;">
<button>Start Select</button>
<button>Stop Select7lt;/button>
</div>
</body>
</html>
But if I go to // W3C // DTD HTML 4.01 or use document.documentElement.clientHeight , then I can get the actual height of the browser: <br / "> 1. Using // W3C // DTD HTML 4.01
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test jQuery Height</title>
<script type="text/javascript" src="../lib/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
$(function(){
var height=document.body.clientHeight;
alert(height);
})
</script>
</head>
<body>
<div style="margin-left:30px;">
<button>Start Select</button>
<button>Stop Select7lt;/button>
</div>
</body>
</html>
- document.documentElement.clientHeight
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test jQuery Height</title>
<script type="text/javascript" src="../lib/jquery-1.8.3.min.js">
</script>
<script type="text/javascript">
$(function(){
var height=document.documentElement.clientHeight;
alert(height);
})
</script>
</head>
<body>
<div style="margin-left:30px;">
<button>Start Select</button>
<button>Stop Select7lt;/button>
</div>
</body>
</html>
, "//W3C//DTD HTML 4.01" "//W3C//DTD XHTML 1.0"?
!