Re: Cursor position (javascript)

  •  12-23-2005, 4:11 AM

    Re: Cursor position (javascript)

    Ok I'll try to explain it better - we're considering to buy your product for a project starting in January but we'd need to solve this issue in some way or other.
     
     As I said, we want to prevent the user from creating nested HTML tables. We remove the original table buttons and create our own, custom button. When the user presses this custom button, it will move the cursor outside any table it might be in at  the moment and then create a new table from a predefined template.
     
    To do this, I need to know where in the HTML the user is currently working. Example:
     
    the HTML is "<html><body>SomeText<table><tr><td>A Cell</td></tr></table></body></html>"
    In Normal view this would look something like "SomeText A Cell" with a line break after SomeText.
    Now say the cursor is before the letter 'A' in the cell. I want to call a javascript function that can return me the character offset of the "cursor" in the HTML data - in this case the number 37.
     
    -Note that all this HTML work is done by the script,
    The user will be working in NORMAL MODE! 
     
    Hope this was more clear. When that is said - we might solve this problem in several other ways, but I found it pretty neat to use tables in this case.
View Complete Thread