-
Enter Key to Post forms?
Hi
how do I get the Enter key by default to post the form?
Because now in .NET there is so much form submitting, how do you set a default action to hitting the Enter key?
Regards
Steve
-
In <body>,
onkeypress='if(window.event.keyCode==13){ event.returnValue=false;event.cancel = true;}
In Search Textbox,
onKeyDown="KeyDownHandler(BtnSearch)"
function KeyDownHandler(btn){
// process only the Enter key
if (event.keyCode == 13)
{
// cancel the default submit
event.returnValue=false;
event.cancel = true;
// submit the form by programmatically clicking the specified button
btn.click();
}
}
I hope you can got some ideas if you change somethings in my code....
-
<body MS_POSITIONING="FlowLayout" onkeypress="if(window.event.keyCode==13){ document.all.btnSearch.click();}">
beauty! thanks
Similar Threads
-
By Mishra N K in forum ASP.NET
Replies: 1
Last Post: 09-02-2003, 11:19 AM
-
By Jim Pragit in forum .NET
Replies: 2
Last Post: 03-31-2002, 12:51 PM
-
By SiaoWei in forum VB Classic
Replies: 1
Last Post: 06-22-2001, 12:22 AM
-
By Mike Ewert in forum Web
Replies: 3
Last Post: 06-20-2001, 12:00 PM
-
By comdna in forum ASP.NET
Replies: 2
Last Post: 02-22-2001, 11:21 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|