Selvom ovenstående virker så resulterede
en lille piller resulterede i:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1"><title>Ingen titel</title>
<script type="text/javascript">
window.onload=function(){
w1=(parseInt(t=document.documentElement.clientWidth))?t:0;
w2=(parseInt(t=document.body.clientWidth))?t:0;
w3=(parseInt(t=window.innerWidth))?t:0;
h1=(parseInt(t=document.documentElement.clientHeight))?t:0;
h2=(parseInt(t=document.body.clientHeight))?t:0;
h3=(parseInt(t=window.innerHeight))?t:0;
w=Math.max(w1,Math.max(w2,w3));
h=Math.max(h1,Math.max(h2,h3));
alert("Bredde: "+w+"\n"+"Højde: "+h);
}
</script></head><body>
</body></html>
... så var vi fri for at checke på op ...
- Det måtte jo kunne gøre kompakt så:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1"><title>Ingen titel</title>
<script type="text/javascript">
window.onload=function(){
var r={e:{0:document.documentElement,1:document.body,2:window},
w:{w:"Width",h:"Height"},c:{},r2:["client","client","inner"]};
for(i in r.w)for(j in r.e)r.c[i+j]=(parseInt(t=(r.e[j][r.r2[j]+r.w[i]])))?t:0
w=Math.max(r.c.w0,Math.max(r.c.w1,r.c.w2));
h=Math.max(r.c.h0,Math.max(r.c.h1,r.c.h2));
alert("Bredde: "+w+"\n"+"Højde: "+h);
}
</script></head><body>
</body></html>
...
...
Rønving, kast et svar for en deler ;)