[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

keycode for "SHIFT F10" ???

Posted on 2001-07-16
4
Medium Priority
?
3,084 Views
Last Modified: 2010-08-05
Hi,
How Can I check keycode for "SHIFT F10", Please let me know asap. Is there any way to find out the other keyCode also like enter,space baar, ctrl,alt,etc...)
I Know the keycode of shift (16 is it okay), that I have taken from the javascript's window.event.keyCode
its giving keycode for seperate  for shift and F10 individually but it's not ging any value when I am pressing Shift + F10 together.

Thanks

PaHmn
0
Comment
Question by:pahmn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:a.marsh
ID: 6287845
This will capture Shift F10 in IE for you:

<html>
<head>
</head>
<body onload="if(window.event){this.focus()}">
<script language="JavaScript">
<!--
function capKey(){
var str = "You've just pressed SHIFT F10";

 if(window.event){
  if(event.shiftKey && event.keyCode == 121){
   alert(str);
  }
}
document.onkeydown=capKey;
//-->
</script>
</body>
</html>
0
 

Author Comment

by:pahmn
ID: 6288187
Great time for response,
I have tried this logic but ctrl is not reaching inside
if(event.shiftKey && event.keyCode == 121){  ...  and this is happening incase of "shift F1,4,6 & 10" , Its working fine for Shift +F2,3,5,7,8,9,11,12.
I thing "shift + F1,4,6,10" are system  defined keys , so please look into this and let me know.

here is my code :

<html>
<head>
</head>
<BODY leftmargin="2" topmargin="2" bgcolor="#CCCC99" onkeyup="checkKey()">
<script language="JavaScript">
<!--

function checkKey(){
var str = "You've just pressed SHIFT F10";

alert(window.event.keyCode);
alert(window.event.shiftKey);

 if(window.event.shiftKey && window.event.keyCode == 121){
  alert(str);

}

}
//-->
</script>
<H3>Test for shift F10</H3>
</body>
</html>

0
 
LVL 15

Accepted Solution

by:
a.marsh earned 120 total points
ID: 6291229
This script should help your further (I found it on the Internet):

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="text/javascript">
  var aK = new Array(2)
  aKClr()

function getKeyCode(state) {
  aK[state] = event.keyCode
}

function aKShow() {
  alert("keyDown "+aK[0]+"\nkeyPress "+aK[1]+"\nkeyUp "+aK[2])
  aKClr()
}

function aKClr() {
  for (var i = 0; i < aK.length; i++) {
    aK[i] = -1
    }
}
</SCRIPT>
</HEAD>

<BODY onLoad="document.all.pcIn.focus();">
Type a key
<INPUT TYPE="text" ID=pcIn MAXLENGTH=1 SIZE=1
  onkeyDown="getKeyCode(0);" onkeyPress="getKeyCode(1);"
  onkeyUp = "getKeyCode(2);aKShow();this.value = '';">
</BODY>
</HTML>

Just make sure the textbox has the focus each time.

As you pointed out above, you'll find some keys won't work as they do special things - but you can work the code out - for example SHIFT F9 works in the script above but SHIFT F10 doesn't - however F!0 comes after F9 which makes it a code of 121 (as F9 is 120).

:o)

Ant
0
 

Author Comment

by:pahmn
ID: 6291686
Marsh,
That is realy a good script to check out the key code but still I was getting the problem with shift + F10, but I have used onkeyDown event for the any button press and I have checked for shift key press by "window.event.shiftKey" and if it returns true I have populated alert. So Its work in this way.

if (window.event.shiftKey){
alert("shiftpass ... tested by hussain");
}

Thanks for coopration.

Pahmn
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question