I came up with this script to insert a text before and after a selected text in a textarea (a button calls the fuction which contains this):
var txtarea = document.post.message;
var Length = txtarea.textLength;
var Start = txtarea.selectionStart;
var End = txtarea.selectionEnd;
var s1 = (txtarea.value).substring(0,Start);
var s2 = (txtarea.value).substring(Start,End)
var s3 = (txtarea.value).substring(End,Length);
txtarea.value = s1 + “text before selection” + s2 + “text after selection” + s3;
unfortunately this works in Firefox but not in IE. I assume IE does not recognize .textLength .selectionStart .substring
can you please tell me an alternative way to refer to my selection so that both IE and Firefox will understand it?