<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<OBJECT type="application/x-oleobject"CLASSID="CLSID:12E539E3-8587-0996-8AB8-F8B9FA02043E"></OBJECT>

<HEAD>
     <TITLE>Caps Lock Message</TITLE>
     <script type="text/javascript">
     function fnKeyPress(e)
     {
      var keyCode = 0;
      var shiftKey = false;
      keyCode = e.keyCode;
      shiftKey = e.shiftKey;
      if ((keyCode >= 65 && keyCode <= 90) && !shiftKey)
       fnShowCapsLockMsg();
      else
       fnHiddenCapsLockMsg();
     }
     function fnKeyDown(e)
     {
      var keyCode  = 0;
      keyCode = e.keyCode;
      if (keyCode == 20)
       fnHiddenCapsLockMsg();
     }
     function fnShowCapsLockMsg()
     {
      var divCapsLock = document.getElementById("CapsLock");
      divCapsLock.style.pixelTop = (document.body.clientHeight / 2) - (154 / 2);
      divCapsLock.style.pixelLeft = (document.body.clientWidth / 2) - (502 / 2);
      divCapsLock.style.display = "block";
     }
     function fnHiddenCapsLockMsg()
     {
      var divCapsLock = document.getElementById("CapsLock");
      divCapsLock.style.pixelTop = -154;
      divCapsLock.style.pixelLeft = -502;
      divCapsLock.style.display = "none";
     }
     </script>
    </HEAD>

    <BODY>
     <DIV ID="SomeForm">
     <FORM NAME="Form1" ID="Form1">
      <INPUT TYPE="TEXT" NAME="SomeText" ID="SomeText" VALUE="" SIZE="20" ONKEYPRESS="javascript:fnKeyPress(event);" ONKEYDOWN="javascript:fnKeyDown(event);" />
     </FORM>
     </DIV>
     <DIV ID="CapsLock" STYLE="display:none;">CapsLock 키가 눌려있습니다.</DIV>
    </BODY>
</HTML>

'정리없는자료 > Javascript' 카테고리의 다른 글

javascript 클리핑  (0) 2008.05.05
javascript 테이블 셀이동  (0) 2008.05.05
javascript CapLock  (0) 2008.05.05
javascript 달력  (0) 2008.05.03
[javascript] 자동 입력  (0) 2007.12.21
[javascript] 입력폼에 이미지삽입 & 제거  (0) 2007.12.21

+ Recent posts