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

M

Michael

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.
 
V

VK

Michael said:
Question 1

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.[/QUOTE]

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)
 
M

Michael

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top