Agustine Posted January 21, 2006 Share Posted January 21, 2006 <script type="text/javascript">function whichButton(event){alert(event.keyCode)}</script> what do I replace the keyCode with so when you press the button "k" for example will display an alert pop up?thanks Link to comment Share on other sites More sharing options...
HighCaliber Posted January 22, 2006 Share Posted January 22, 2006 Here you go. <script type="text/javascript"><!--function Alert_k(){ if (window.event.keyCode == 107) {alert('Hello World')};}//--></script> Place this in your body: <body onKeyPress="Alert_k()"> Key Codes 09 = Tab 11 = Home 13 = Enter32 = Space Bar 33 = ! 34 = "35 = # 36 = $ 37 = %38 = & 39 = ' 40 = (41 = ) 42 = * 43 = +44 = , 45 = - 46 = .47 = / 48 = 0 49 = 150 = 2 51 = 3 52 = 453 = 5 54 = 6 55 = 756 = 8 57 = 9 58 = :59 = ; 60 = < 61 = =62 = > 63 = ? 64 = @65 = A 66 = B 67 = C68 = D 69 = E 70 = F71 = G 72 = H 73 = I74 = J 75 = K 76 = L77 = M 78 = N 79 = O80 = P 81 = Q 82 = R83 = S 84 = T 85 = U86 = V 87 = W 88 = X89 = Y 90 = Z 91 = [92 = \ 93 = ] 94 = ^95 = - 96 = ` 97 = a98 = b 99 = c 100 = d101 = e 102 = f 103 = g104 = h 105 = i 106 = j107 = k 108 = l 109 = m110 = n 111 = o 112 = p113 = q 114 = r 115 = s116 = t 117 = u 118 = v119 = w 120 = x 121 = y122 = z 123 = { 124 = |125 = } 126 = ~ Chris Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now