smiles Posted January 29, 2006 Share Posted January 29, 2006 we always seee in w3 examples have a button with value " edit the text and click me" , how could we give a short cut key for it , ENTER key ? Thanks Link to comment Share on other sites More sharing options...
scott100 Posted January 30, 2006 Share Posted January 30, 2006 we always seee in w3 examples have a button with value " edit the text and click me" , how could we give a short cut key for it , ENTER key ? Thanks<{POST_SNAPBACK}> Is this what you are needing? <html><head><title></title><script language="JavaScript" type="text/javascript">function keyPress() { window.document.onkeydown=findKey;}function findKey(evt) { var evt = (evt) ? evt : ((window.event) ? event : null); if (evt.type == 'keydown') { var charCode = (evt.charCode) ? evt.charCode : evt.keyCode; if (charCode == 13)alert ("You have hit the enter key"); }}</script></head><body onload="keyPress()">Edit the text and click enter<br /></body></html> Link to comment Share on other sites More sharing options...
smiles Posted January 31, 2006 Author Share Posted January 31, 2006 yeah , it nears what I want , only change a littleif (charCode == 13)alert ("You have hit the enter key");toif (charCode == 13)window.location="http://www.w3schools.com"; thanks so much Link to comment Share on other sites More sharing options...
MrAsheSin Posted June 4, 2007 Share Posted June 4, 2007 Question: is there a list of the values for the various keys (in the above example, 13 is enter). I'm trying to write a script for Acrobat 6, allowing me to press the space key and have the pdf react as though I had hit the tab key (but only for those fields). If so, please message me or post here. Thank you! Link to comment Share on other sites More sharing options...
jesh Posted June 4, 2007 Share Posted June 4, 2007 Question: is there a list of the values for the various keys (in the above example, 13 is enter). I'm trying to write a script for Acrobat 6, allowing me to press the space key and have the pdf react as though I had hit the tab key (but only for those fields). If so, please message me or post here. Thank you!I know of no such list (Google may help) but when I need to know a code, I typically do this (using the example code above):function findKey(evt){ var evt = (evt) ? evt : ((window.event) ? event : null); if (evt.type == 'keydown') {var charCode = (evt.charCode) ? evt.charCode : evt.keyCode;alert(charCode); // this tells you the code for each key pressed.} Link to comment Share on other sites More sharing options...
justsomeguy Posted June 5, 2007 Share Posted June 5, 2007 Go to asciitable.com, the numbers you need are those in the decimal numbers column, not hex, octal, or html. Link to comment Share on other sites More sharing options...
MrAsheSin Posted June 5, 2007 Share Posted June 5, 2007 Go to asciitable.com, the numbers you need are those in the decimal numbers column, not hex, octal, or html.thank you! 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