开发者

Focus cursor to a submit button

I have a standard form for a user login.

When I input the username and password, then press enter it gives the search result. The search text box is in the same page.

I want to set the focus on the submit button. The enter key issue only exists in IE? W开发者_StackOverflow中文版hat can I do to solve this problem?


You can focus anything with the focus() javascript method. This has nothing to do with PHP.

document.getElementById('ID_Name_Of_Your_Button').focus();


Submit button must be defined in the same form tag as the other form elements. And submit will be fired on what form you are focused while pressing [enter].

You don't need to focus any submit buttons in your case.

And the document content is needed for the more exact answer of course.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜