본문 바로가기

Javascript

자바스크립트 사이즈 가지구 놀기


실제로 원한 소스는

 var CorrectWidth = window.document.body.scrollWidth - window.document.body.clientWidth;
 var CorrectHeight = window.document.body.scrollHeight - window.document.body.clientHeight - 10;
 window.resizeBy(CorrectWidth,CorrectHeight);

이건데 아래건 테스트하려구 놔둔거임

 function WriteStatus()
 {
  try{
   var Status = "";

   Status += "window.width = " + window.width + "<BR>";
   Status += "window.height = " + window.height + "<BR>";
   Status += "window.document.width = " + window.document.width + "<BR>";
   Status += "window.document.height = " + window.document.height + "<BR>";

   Status += "window.dialogLeft = " + window.dialogLeft + "<BR>";
   Status += "window.dialogTop = " + window.dialogTop + "<BR>";
   Status += "window.dialogWidth = " + window.dialogWidth + "<BR>";
   Status += "window.dialogHeight = " + window.dialogHeight + "<BR>";

   Status += "window.screenLeft = " + window.screenLeft + "<BR>";
   Status += "window.screenTop = " + window.screenTop + "<BR>";
   Status += "window.screen.width = " + window.screen.width + "<BR>";
   Status += "window.screen.height = " + window.screen.height + "<BR>";
   Status += "window.screen.availWidth = " + window.screen.availWidth + "<BR>";
   Status += "window.screen.availHeight = " + window.screen.availHeight + "<BR>";

   Status += "window.document.body.clientTop = " + window.document.body.clientTop + "<BR>";
   Status += "window.document.body.clientLeft = " + window.document.body.clientLeft + "<BR>";
   Status += "window.document.body.clientHeight = " + window.document.body.clientHeight + "<BR>";
   Status += "window.document.body.clientWidth = " + window.document.body.clientWidth + "<BR>";
   Status += "window.document.body.scrollLeft = " + window.document.body.scrollLeft + "<BR>";
   Status += "window.document.body.scrollTop = " + window.document.body.scrollTop + "<BR>";
   Status += "window.document.body.scrollWidth = " + window.document.body.scrollWidth + "<BR>";
   Status += "window.document.body.scrollHeight = " + window.document.body.scrollHeight + "<BR>";
   Status += "window.document.body.offsetTop = " + window.document.body.offsetTop + "<BR>";
   Status += "window.document.body.offsetLeft = " + window.document.body.offsetLeft + "<BR>";
   Status += "window.document.body.offsetHeight = " + window.document.body.offsetHeight + "<BR>";
   Status += "window.document.body.offsetWidth = " + window.document.body.offsetWidth + "<BR>";

   Status += "window.document.documentElement.clientTop = " + window.document.documentElement.clientTop + "<BR>";
   Status += "window.document.documentElement.clientLeft = " + window.document.documentElement.clientLeft + "<BR>";
   Status += "window.document.documentElement.clientHeight = " + window.document.documentElement.clientHeight + "<BR>";
   Status += "window.document.documentElement.clientWidth = " + window.document.documentElement.clientWidth + "<BR>";
   Status += "window.document.documentElement.scrollLeft = " + window.document.documentElement.scrollLeft + "<BR>";
   Status += "window.document.documentElement.scrollTop = " + window.document.documentElement.scrollTop + "<BR>";
   Status += "window.document.documentElement.scrollWidth = " + window.document.documentElement.scrollWidth + "<BR>";
   Status += "window.document.documentElement.scrollHeight = " + window.document.documentElement.scrollHeight + "<BR>";
   Status += "window.document.documentElement.offsetTop = " + window.document.documentElement.offsetTop + "<BR>";
   Status += "window.document.documentElement.offsetLeft = " + window.document.documentElement.offsetLeft + "<BR>";
   Status += "window.document.documentElement.offsetHeight = " + window.document.documentElement.offsetHeight + "<BR>";
   Status += "window.document.documentElement.offsetWidth = " + window.document.documentElement.offsetWidth + "<BR>";


   document.getElementById("WindowStatus").innerHTML = Status;
   setTimeout("WriteStatus()",3000);
  }
  catch(e){setTimeout("WriteStatus()",100)};
 }
 WriteStatus()

 function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
   //Non-IE
   myWidth = window.innerWidth;
   myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
   //IE 6+ in 'standards compliant mode'
   myWidth = document.documentElement.clientWidth;
   myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
   //IE 4 compatible
   myWidth = document.body.clientWidth;
   myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
 }