monolithed,
на всякий случай ))) смотреть в opera
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
window.onload = function(){
var opera = (navigator.userAgent.toLowerCase().indexOf('opera') > -1),
html = document.documentElement,
body = document.body,
w = document.compatMode=='CSS1Compat' && !opera ? html.clientWidth : body.clientWidth,
h = document.compatMode=='CSS1Compat' && !opera ? html.clientHeight : body.clientHeight;
alert("Размер вьюпорта: "+ w +"х"+ h);
};
</script>
</head>
<body>
</body>
</html>
с дополнением для оперы
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
window.onload = function(){
var html = document.documentElement,
body = document.body,
w = document.compatMode=='CSS1Compat' && !window.opera ? html.clientWidth : body.clientWidth,
h = document.compatMode=='CSS1Compat' && !window.opera ? html.clientHeight : body.clientHeight;
if (document.compatMode == "CSS1Compat" && window.opera) {
w = window.innerWidth;
h = window.innerHeight
}
alert("Размер вьюпорта: "+ w +"х"+ h);
};
</script>
</head>
<body>
</body>
</html>
Вариант
Kolyaj
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function getRootElement(doc) {
doc = doc || document;
return doc.compatMode == 'CSS1Compat' ? doc.documentElement : doc.body;
}
function getViewportSize(doc) {
doc = doc || document;
var elem = getRootElement(doc);
return [elem.clientWidth, elem.clientHeight];
}
window.onload = function(){
alert("Размер вьюпорта: "+ getViewportSize()[0] +"х"+ getViewportSize()[1]);
};
</script>
</head>
<body>
</body>
</html>