Results 1 to 2 of 2

Thread: How to call this fucntion from text box

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2002
    Location
    Hampton Beach
    Posts
    513

    Question How to call this fucntion from text box

    I have a text box and I want the function to run only if the user has clicked or tab over to the TxtBox1 and the user presses F9 on their keyboard



    document.onkeyup = handleKeyUp;

    function handleKeyUp(e)
    {
    if(!e)
    var e = window.event;

    key = e.keyCode;
    Frm.txtBox1.value = key;

    if (key == 120)
    {
    alert("You pressed F9 key");
    }

    }

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Here's some code a friend of mine wrote not long ago:
    Code:
    <SCRIPT LANGUAGE="JavaScript">
    function CheckForEnter()
    {
       if(event.keyCode == 13)
          document.getElementById("Send").click();
    }
    </SCRIPT>
    
    <textarea cols=50 rows=4 name=message id=message onKeyPress="CheckForEnter();"></textarea><br>
    <input type=button value=Send! ID="Send" NAME="Send" onClick='erase_data()'>
    You should be able to edit that easily enough to suit your needs.
    Have I helped you? Please Rate my posts.

Posting Permissions

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



Click Here to Expand Forum to Full Width