Ah. Interesting, didn't realize that. I may have to clone it then and rename it. I don't want it affecting everything else.
function AddText(text) {
var crtScrollTop;
var crtScrollLeft;
try {
var tarea = document.PostTopic.Message;
if (typeof tarea.scrollTop != 'undefined') {
crtScrollTop = tarea.scrollTop;
crtScrollLeft = tarea.scrollLeft;
}
} catch (e) {};
var tarea = document.PostTopic.Message;
if (typeof tarea.selectionStart != 'undefined')
{ // if it supports DOM2
start = tarea.selectionStart;
end = tarea.selectionEnd;
tarea.value = tarea.value.substr(0,tarea.selectionStart)
+ text + tarea.value.substr(tarea.selectionEnd);
tarea.focus();
if (start === end )
{
res = text.split("/");
if (res.length > 1)
{
tarea.selectionStart = start + (text.length) / 2;
tarea.selectionEnd = tarea.selectionStart;
}
}
else
{
tarea.selectionStart = ((start - end) == 0) ? start + text.length : start;
tarea.selectionEnd = start + text.length;
}
}
else
{
if (tarea.createTextRange && tarea.caretPos) {
var caretPos = tarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
}
else {
tarea.value += text;
}
tarea.focus(caretPos);
}
try {
var tarea = document.PostTopic.Message;
if (typeof tarea.scrollTop != 'undefined') {
tarea.scrollTop = crtScrollTop;
tarea.scrollLeft = crtScrollLeft;
}
} catch (e) {};
}
Or maybe come up with a new function just for this?