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!

Focus form button in Netscape

Status
Not open for further replies.

leardvr

MIS
Feb 16, 2001
3
US
In Netscape (4.7) I focus a form, however, the "enter" key does not envoke the submit button automatically, I either have to call an onChange event from the previous field which diverts focus to the submit button, or click the button manually. Is there any way to specify the "enter" key to activate the submit without specifically focusing it?

Thanks
 
think this will work:

<script>
ns4 = (document.layers)?true:false;
ie4 = (document.all)?true:false;

function keyDown(e)
{
if(ns4){var keyhit=e.which;}
if(ie4){var keyhit=event.keyCode;}
if(keyhit==13)
{
document.formname.submit()
}
}

document.onkeydown = keyDown
if (ns4) document.captureEvents(Event.KEYDOWN)



</script> jared@aauser.com -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top