Simple HTML help

Tom Metro blu at vl.com
Sat Mar 25 01:55:48 EST 2006


Robert La Ferla wrote:
> I was trying to get submitting via enter to work.  But this is how it is done with a button:
> ...
> <FORM NAME="myform">URL:
> <INPUT TYPE="text" NAME="url" VALUE=""> 
> <INPUT TYPE="button" NAME="button" Value="GO" onClick="window.location = myform.url.value">
> </FORM>
> ...
> Here is a version that doesn't require a button:
> 
> <!--
> function checkkey(e)
> {
> var k;
> 
> if (window.event) {
> k = window.event.keyCode;
> }
...

I believe you can have enter trigger the action without having to resort 
to a window event handler by simply changing your button into a submit 
type button. (The code that performs the redirect might need to change 
from an onClick handler to an onsubmit handler.)

  -Tom

-- 
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: http://tmetro.venturelogic.com/



More information about the Discuss mailing list