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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post

    how to get character before cursor

    I am trying to work out a way of returning the character BEFORE the cursor position using an onkeypress command.

    for example:

    th|


    if the pipeline above is the cursor - when the user types the next letter, I want to be able to get the letter before that. So in this case, the script would return "h"

    I've tried using some of the following commands:

    Code:
    var code = iView.document.selection;
    var tmp = code.createRange();	
    
    tmp.expand("character",1);
    but nothing seemed to work.

    any help is much appreciated.... thanks

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try the forum Search. This question was asked and resolved approximately a month ago. I'm sure you will find your answer there.

    .....Willy

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post
    oh god!! It was me that asked the question as well!!!



    *stupid*

    sorry about that!!!!


  •  

    Posting Permissions

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