본문 바로가기
Web Programing!/Script

[SCRIPT] 해상도에 따라 배경 바꾸기

by 어설픈봉봉이 2011. 10. 22.
반응형
SMALL



<SCRIPT LANGUAGE="JavaScript">
<!--
  var Size = "UnCommon"

  if (navigator.appVersion.indexOf("4.") != -1 &&
      navigator.appName.indexOf("Explorer") != -1) {
     ScrnSize = screen.width + "x" + screen.height;
  }

  if (navigator.appVersion.indexOf("4.") != -1 &&
      navigator.appName.indexOf("Netscape") != -1) {
     ScrnSize = screen.width + "x" + (screen.height + 19);
  }

  switch(Size) {
    case "640x480":   document.write('<body bgcolor="#FF0000" text="#000000">');
    case "800x600":   document.write('<body bgcolor="#00FF00" text="#000000">');
    case "1024x768":  document.write('<body bgcolor="#0000FF" text="#000000">');
    case "1152x864":  document.write('<body bgcolor="#FFFF00" text="#000000">');
    case "1280x1024": document.write('<body bgcolor="#AA0000" text="#000000">');
    case "1600x1200": document.write('<body bgcolor="#FF00FF" text="#000000">');
    case "1600x1280": document.write('<body bgcolor="#00AA00" text="#000000">');
    default:          document.write('<body bgcolor="#FFFFFF" text="#000000">'); // 위의 해상도 크기에 맞지 않을때.
  }

  document.write('<b>Browser Type :</b> '+navigator.appName+'<BR>');                     // 브라우저 형태
  document.write('<b>Browser Version :</b> '+navigator.appVersion+'<BR>');               // 브라우저 버전
  document.write('<b>Screen Resolution :</b> '+screen.width+"x"+screen.height+'<Br>');   // 해상도 크기
//-->
</script> 


반응형