i know this much, mozilla is "retarded" when it comes to dealing with text. compare...
the scripting it takes to do the button for IE:
Code:
if (text.substring(0, vbcode.length + 2 ) == "[" + vbcode + "]" && text.substring(text.length - vbcode.length - 3, text.length) == "[/" + vbcode + "]")
{
AddTxt = text.substring(vbcode.length + 2, text.length - vbcode.length - 3);
}
else
{
AddTxt = "[" + vbcode + optioncompiled + "]" + text + "[/" + vbcode + "]";
}
AddText(AddTxt);
the scripting it takes to do the button for Mozilla:
Code:
var start_selection = theform.message.selectionStart;
var end_selection = theform.message.selectionEnd;
// fetch everything from start of text area to selection start
var start = (theform.message.value).substring(0, start_selection);
// fetch everything from start of selection to end of selection
var middle = (theform.message.value).substring(start_selection, end_selection);
// fetch everything from end of selection to end of text area
var end = (theform.message.value).substring(end_selection, theform.message.textLength);
if (middle.substring(0, vbcode.length + 2 ) == "[" + vbcode + "]" && middle.substring(middle.length - vbcode.length - 3, middle.length) == "[/" + vbcode + "]")
{
middle = middle.substring(vbcode.length + 2, middle.length - vbcode.length - 3);
}
else
{
middle = "[" + vbcode + optioncompiled + "]" + middle + "[/" + vbcode + "]";
}
theform.message.value = start + middle + end;
setfocus();
theform.message.selectionStart = end_selection + middle.length;
theform.message.selectionEnd = start_selection + middle.length;
return false;