[thelist] JS for creating html styles/links

Peter-Paul Koch gassinaumasis at hotmail.com
Tue Feb 25 09:35:00 CST 2003


>>>I'm figuring there has to be lots of JavaScripts available that will
>>>allow non-html-savy people to insert <strong> <em> <a> <p> <hx> tags, etc
>>>into <textarea>s.
>>
>>It's surprisingly difficult to write a cross-browser script for this. As
>>far as I know it's not possible, for instance, to find the cursor position
>>in the textarea in Mozilla.
>>So in my experience it's not possible to write a cross-browser script.
>
>I wondered about whether one could get the selection of a textarea
>after I sent the mail ... however, would it not be possible to have a
>textarea and a "preview" section dynamically updated via innerHTML, and
>find the selection on that?

Same problem: you can find out which text the selection contains, but not
where in the textarea or innerHTML the text is located. Of course you could
try through indexOf(selected string) but if the string is short and common
('the ' for instance) this may return the wrong part of the
textarea.value/innerHTML .

Forget the JavaScript solution, it simply doesn't (yet) exist.

--------------------------------------------------
ppk, freelance web developer
Interaction, copywriting, JavaScript, integration
http://www.xs4all.nl/~ppk/
Column "Keep it Simple": http://www.digital-web.com/columns/keepitsimple/
W3C DOM Compatibility Table, expanded & updated
http://www.xs4all.nl/~ppk/js/index.html?version5.html
--------------------------------------------------


_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail




More information about the thelist mailing list