Finding the position of the cursor in a text box & Rich formated <textarea>

Discussion in 'Javascript' started by Michael, Feb 16, 2006.

  1. Michael

    Michael Guest

    Question 1
    ----------------
    I am writing an advanced BBCode system for my forums and I would like
    to be able to find where the cursor was positioned last in the text so
    I could insert the BBCode there.

    Question 2
    ----------------
    Again I am writing an advanced BBCode system for my forums and I would
    like to make is so that when someone puts in a tag it goes bold, so
    kind of a WYSIWYG editor and also for other things like tags and
    [url] tags. So could someone tell me how to do that. I would preferably
    like it to still use the textarea tag, or at least a form component so
    my existing code works.
     
    Michael, Feb 16, 2006
    #1
    1. Advertising

  2. Michael

    VK Guest

    Michael wrote:
    > Question 1
    > ----------------
    > I am writing an advanced BBCode system for my forums and I would like
    > to be able to find where the cursor was positioned last in the text so
    > I could insert the BBCode there.


    Something like
    <http://www.alexking.org/blog/2003/06/02/inserting-at-the-cursor-using-javascript/>

    Cursor position in textarea is one of DOM model failures: evidently
    needed, idiotically complicated to get.


    > Question 2
    > ----------------
    > Again I am writing an advanced BBCode system for my forums and I would
    > like to make is so that when someone puts in a tag it goes bold, so
    > kind of a WYSIWYG editor and also for other things like tags and
    > [url] tags. So could someone tell me how to do that. I would preferably
    > like it to still use the textarea tag, or at least a form component so
    > my existing code works.[/color]

    Here's oopsy :-(

    Textarea has the atomic formatting: so you can apply any style but to
    the entire textarea only. You need to use <div>, <iframe> etc.
    JavaScript WYSIWYG editors of all quality and capabilities around the
    Web, as it's one of preffered programming toys. I would suggest to look
    for a suitable widget:
    <http://www.google.com/search?hl=en&lr=&q=wysiwyg+editor+javascript&btnG=Search>

    (Unless you are planning to use WYSIWYG programming to learn JavaScript
    on your own)
     
    VK, Feb 16, 2006
    #2
    1. Advertising

  3. Michael

    Michael Guest

    Ok, thanks that helps. I will probably not bother with the WYSIWYG
    editor for a little while because it will obviously need alot of work,
    but I will implement the cursor position thing soon though.
     
    Michael, Feb 17, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DaveR
    Replies:
    2
    Views:
    6,602
    Dave Rudlin
    Nov 17, 2004
  2. walterbyrd
    Replies:
    13
    Views:
    1,302
    walterbyrd
    May 13, 2009
  3. dmaziuk
    Replies:
    3
    Views:
    583
    Chris Gonnerman
    Jan 25, 2011
  4. Thriving K.
    Replies:
    1
    Views:
    133
    Thriving K.
    Jul 14, 2009
  5. cyber0ne
    Replies:
    0
    Views:
    121
    cyber0ne
    Apr 29, 2005
Loading...

Share This Page