stupid cross-browser javascript

| 2 Comments

Today's lesson: just when you think you know, you find out you just don't know.

I started trying to write some javascript that adds bold and italic tags to a selection in a textarea. If you check out the comments section at a place like kottke's site, you'll see what I'm looking for. Problem is that there, and in Movable Type, it only works in versions of IE. Now from what I've read, it should be possible to do using a combination of window.getSelection and the selection attributes, but I'm a little confused as to how to access the attributes of a selection. Documentation seems to be sketchy, consisting of some documented interface code with no examples and some pages claiming that the getRange functions are broken in Mozilla. If anyone has any suggestions, let me know.

2 Comments

use execCommand, compatible with IE and Moz/NN

use execCommand, compatible with IE and Moz/NN

Recent Entries

NY Times Profile: Madden
I've always thought Madden was a goofball. Now I'm not so sure. The common complaint with Madden, who joined NBC's…
Goodbye Manny, Goodbye Manny...
It's time to say goodbye...  Nomar, Pedro, Trot, Manny, Damon, etc. etc. This Red Sox team new, with new young…
Sean Tevis and his campaign for KS state rep.
Until recently, I'd never given money to a political candidate or a political action committee. Two things changed that: The…