Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Dec 2007
    Posts
    269
    Thanks
    28
    Thanked 0 Times in 0 Posts

    alert when pressing TAB

    when i pressed tab (while on textfield and not on ) i wanna open an alert dialog . is it possible ?

    Code:
    <form id="form1" name="form1" method="post" action="">
      <label>
      <input type="text" name="textfield" />
      </label>
    </form>

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,011
    Thanks
    203
    Thanked 2,538 Times in 2,516 Posts
    Code:
    <script type="text/javascript">
    function codeNum(e){
    if(!e) {e = window.event}
    if(e.keyCode) {alert(e.keyCode)}
    else {alert(e.charCode)}
    if ((e.keyCode == 9) || (e.charCode == 9)) {
    alert ("You pressed the tab key");
    }
    }
    </script>
    
    <input type="text" id = "txt1" size = "50" onkeydown="codeNum(event)"/>
    </body>

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
    Last edited by Philip M; 09-01-2008 at 12:14 PM. Reason: Mod to work with both IE and Firefox

  • Users who have thanked Philip M for this post:

    zodehala (09-03-2008)

  • #3
    Regular Coder
    Join Date
    Dec 2007
    Posts
    269
    Thanks
    28
    Thanked 0 Times in 0 Posts
    thanx for reply but i can not do it for regex

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,011
    Thanks
    203
    Thanked 2,538 Times in 2,516 Posts
    Quote Originally Posted by zodehala View Post
    thanx for reply but i can not do it for regex
    Sorry, I do not understand.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •