Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, i wanted to know how to activ

Status
Not open for further replies.

iooo

Programmer
Dec 27, 2000
31
CA
Hi,
i wanted to know how to activate a client script on key board click of enter key rather than using the mouse .
my code is

<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function submit1_onclick() {
alert(&quot;wait:&quot;)
FORM1.d

}

//-->
</SCRIPT>
</HEAD>
<BODY>
<P>&amp;nbsp;</P>
<P>
<FORM action=&quot;hello.asp&quot; id=FORM1 method=post name=FORM1>
<P>&amp;nbsp;</P>
<P>

<INPUT id=text1 name=text1 style=&quot;LEFT: 10px; TOP: 19px&quot; CHECKED>
<INPUT type=&quot;submit&quot; value=&quot;Submit&quot; id=submit1 name=submit1 LANGUAGE=javascript onclick=&quot;return submit1_onclick()&quot;>
</P>
</FORM>
<P></P>
</BODY>
</HTML>

but this code workks by clicking the submit button using mouse and when enter key is used it goes to another page
some one please answer the question
 
I am not sure of what are you asking 100%, but let me take a stab.

Are you saying that you don't want the user to use their mouse button for the submit button and instead use their Enter key?

If so, I do not think that is possible.

Is this what you are trying to say?

-Vic vic cherubini
malice365@hotmail.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====
 
Well according to MSDN we can actually capture the Enter key, as well as every other.I have yet to get this to work, but in theory the event object can be queried by some function called onkeypress. See if you can make sense of what they say...


-Ben &quot;Alright whatever man, I'll hook up the hair, but I aint touchin the ring...Cause I'm still a pla--yer&quot;
 
put this line in the onsubmit handler of your form instead of the button:

return submit1_onclick()

that should work jared@aauser.com
 
of course it doesn't submit when you press a key as you're using the onclick event : onclick reacts to clicks, not to key press !!!!!! cut this onclick call, and use jaredn's tip, use onsubmit in the form tag
 
Hi,
I used it in OnSubmit of the form and it did work
thanks a lot to all of u

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top