Queridos, boa tarde!
Tenho a seguinte função:
function
applyTag(obj) {
wrapText(obj,
'[alter]', '[/alter]');
};
function
wrapText(obj, beginTag, endTag) {
if(typeof obj.selectionStart == 'number') {
// FF
var start = obj.selectionStart;
var end = obj.selectionEnd;
obj.value = obj.value.substring(0, start) + beginTag + obj.value.substring(start, end) + endTag + obj.value.substring(end, obj.value.length);
}
else if(document.selection) {
// IE
obj.focus();
var range = document.selection.createRange();
if(range.parentElement() != obj) return false;
if(typeof range.text == 'string')
document.selection.createRange().text = beginTag + range.text + endTag;
}
else
obj.value += text;
};
e nela preciso ao finalizar posicionar o mouse apóes o beginTag, acontece que já tentei de tudo e não rola, alguém pode me dar um help?
Ah, chamo a função desta forma:
<
asp:TextBox onclick="applyTag(document.getElementById('pr_txt_objetivos'))" ID="pr_txt_objetivos" runat="server" TextMode="MultiLine" width="100%" height="200px"></asp:TextBox>
Muito obrigada!!!!