In textarea in a form:
1)Select text with cursor
2)Click a button (say bold)
3)The selected text gets <b>selected text</b> HTML bold tags written around it - without moving the selected text from it's position in the rest of the text.
Hope you can help.
Thanks - Ted
Posted by TedH (TedH), 30 October 2004Thought I'd stick a page up with it so folk might understand the problem more easier.
<A HREF="http://www.bluwall.com/testbutton.html" target="_blank">
Any extra additions from a button autmatically puts it after the existing text.
JS is on the page (view source).
Have fun - Ted
Posted by Custard (Custard), 30 October 2004Just had a google, and came up with this...
Which possibly looks like your man!
Couldn't test as I use Safari..
Hate to say it, but Microsoft have a quite good set of docs for DOM and JS.
Posted by TedH (TedH), 31 October 2004I'll get that and see what I can do with it - thanks Ted
If anyone else has any ideas I'll have a look at them too - cheers
Posted by TedH (TedH), 31 October 2004Well, it works to a degree, but not very well. I did find a couple of other bits that would turn text bold, but unfortunately it turns all the text in the form bold without any HMTL tags.
Well it was worth a try anyway. Looks like I shall have to simply write very exact instructions on how to use the editor. Once a user gets used to it should not be a problem.
Thanks - Ted
Posted by TedH (TedH), 2 November 2004After a bit of thought and messing around I contacted a friend who's a JS expert and he gave me a bit of code.
While not absolutely perfect is works well enough.
The "After thought" buttons work quite well on selected text. But - can mess up things if you click a button without selecting anything. A page refresh seems to solve that okay.
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho