Results 1 to 2 of 2

Thread: TextBox Question??

  1. #1
    Join Date
    Mar 2010
    Location
    Canada
    Posts
    32
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default TextBox Question??

    I would like to type something into my textbox and then press ENTER, it will execute a function.

    I tried onFocus, onChange and onBlur but it doesn't do what I want it to.

    Here's an example I use for onChange.

    Code:
    Application: <input type="text" onchange="execProg(0);">
    Any comments or suggestions is greatly

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <script  type="text/javascript">
    /*<![CDATA[*/
    function Enter(obj){
     var e=window.event||arguments.callee.caller.arguments[0];
     var kc=e.which?e.which:event.keyCode;
     if (kc===13){
      alert('execute');
     }
    //execProg(0)
    }
    /*]]>*/
    </script>
    
    </head>
    
    <body>
    Application: <input type="text" onkeypress="Enter(this);">
    </body>
    
    </html>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

Bookmarks

Posting Permissions

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