473,322 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

detect keypress for return-key

while enter key pressed , i want to call one java script
Oct 23 '07 #1
4 2204
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

Can you give an example? Post your code too.
Oct 23 '07 #2
JamieHowarth0
533 Expert 512MB
Hi there,

Use:
Expand|Select|Wrap|Line Numbers
  1. <input type="text" onkeypress="javascript:calltoJSFunction()" />
Hope it helps.

medicineworker
Oct 23 '07 #3
gits
5,390 Expert Mod 4TB
Hi there,

Use:
Expand|Select|Wrap|Line Numbers
  1. <input type="text" onkeypress="javascript:calltoJSFunction()" />
Hope it helps.

medicineworker
hi ...

that's half of the work :) since this calls the function on every keypress ... now in that function we have to retrieve the event's keyCode ...

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function calltoJSFunction(e) {
  3.     if (window.event) {
  4.         e = window.event;
  5.     }
  6.  
  7.     if (e.keyCode == 13) {
  8.         alert('you pressed the return-key');
  9.     }
  10. }
  11. </script>
  12.  
  13. <input type="text" onkeypress="calltoJSFunction(event)" />
kind regards
Oct 23 '07 #4
gits
5,390 Expert Mod 4TB
changed thread title to better describe the problem ... please always use a good thread title

kind regards
Oct 23 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

23
by: Michel Bany | last post by:
I am trying to parse responseXML from an HTTP request. var doc = request.responseXML; var elements = doc.getElementsByTagName("*"); the last statement returns an empty collection when running from...
8
by: bissatch | last post by:
Hi, I have a text box where the user enters their employee email address. What I want to occur is when the @ sign is pressed it will automatically add the rest (ie. mycompany.com) I know the...
2
by: dude | last post by:
How do I detect that there has been no activity on a form in an Access 97 Database Paul thanks
1
by: Josh | last post by:
Hi, I want to detect the keystroke entered by the user in my application. Actually the scenarion is, at first the user is entering some details to the windows form, later on he is idle for few...
1
by: Darren Coleman | last post by:
I need help with 2 keyboard/input questions 1. How do i caputre all keypress events for my application/form? 2. How do I determine which keyboard sent the keypress? What i'm doing is using a...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
1
by: Terry Olsen | last post by:
I have a chat application. I want it to show the user as "away" if no activity on the computer occurs for a certain amount of time. I have a timer that I set for the correct interval, when it...
1
by: Dusty Hackney | last post by:
Hello, I am programming aspx pages in VB ASP.NET. When using Windows forms, I am able to use an event called KeyPress. However, I haven't been able to get this to work in a Web Form. What do...
0
by: Rich | last post by:
Hello, I have been using "Concole.WriteLine("Event Name") for almost every event in the datagridview control, but I can't get the KeyPress event to file. My goal is to force uppercase on the...
6
by: mbewers1 | last post by:
I've never handled keysroke events before and I would like to implement a Return keystroke event in a Windows form to bring up a list of items in a datagrid as well as habing a search button in the...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.