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
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts

    shortcut keys to place text in textarea?

    Hello,

    I'm trying to find a way to insert some text into a textarea by using a short cut key,, like F8 or something.

    i've seen this done before but have no idea how to do it myself,
    was hoping that some one might be able to show me an example?


    thanks in advance for your time!
    -Ken

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This should get you started:

    Code:
    <script type="text/javascript">
    function insert(evt) {
    var key;
    if (window.Event) key = evt.which;
    else key = event.keyCode;
    if(key == 45) {
    stb = document.STORY.STORYBODY;
    str = stb.value;
    nme = 'Name ';
    stb.value = str+nme;
    stb.focus();
    }
    }
    document.onkeydown = insert;
    </script>
    </HEAD>
    
    <BODY onload="document.STORY.STORYBODY.focus()">
    <form name="STORY">
    <textarea name="STORYBODY" cols="75" rows="15" wrap="PHYSICAL"></textarea><br>
    </form>
    .....Willy

  • #3
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    thanks!
    but i'm not sure how it works,
    what key do i push? and what gets inserted?

    thanks again for your time!
    -Ken

  • #4
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    can anyone help me with this?

    thanks agian for your time!
    -Ken


  •  

    Posting Permissions

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