Jump to content

enter key for replacing


smiles

Recommended Posts

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

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

  • 1 year later...

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...