How to convert the Enter key to the tab key in Firefox

Source: Internet
Author: User
ArticleDirectory
    • Answer
There are multiple input fields in form. You can navigate through tabs in these input fields. You need to press the Enter key to obtain the same effect as the tab.
Convert the Enter key to the tab key

Can be implemented in IE,CodeThe following HTML code

  1. <Html Xmlns=Http://www.w3.org/1999/xhtml">
  2. <Head>
  3. <Meta HTTP-equiv="Content-Type" Content="Text/html; charset = UTF-8">
  4. <Title>Untitled document</Title>
  5. <Script Type="Text/JavaScript">
  6. Function entertotab (event ){
  7. VaRE=Event? Event: window. Event
  8. If (E. keycode= 13 ){
  9. E. keycode=9;
  10. }
  11. }
  12. </Script>
  13. </Head>
  14. <Body>
  15. <Form>
  16. <Input ID="Input1" Type="Text">
  17. <Input ID="Input2" Type="Text">
  18. <Input ID="Input3" Type="Text">
  19. <Input ID="Input4" Type="Text">
  20. </Form>
  21. </Body>
  22. </Html>
<HTML xmlns = "http://www.w3.org/1999/xhtml">  

However, the keycode of the event in Firefox is read-only and cannot be modified. I do not know how to implement this function in Firefox.

Answer
    1. FunctionEntertotab (OBJ, event ){
    2. VaRE = event? Event: window. Event
    3. If(E. keycode = 13 ){
    4. OBJ. nextsibling. Focus ();
    5. Return False;
    6. }
    7. }
 
Function entertotab (OBJ, event) {var E = event? Event: window. eventif (E. keycode = 13) {obj. nextsibling. Focus (); Return false ;}}

The function transmits another parameter, that is, this of the current Dom. The principle is that the current input of the entry, so that the mouse focus is obtained to the next input box.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.