Reset Cursor after inserting bbcode
Posted: Fri Oct 08, 2004 9:46 am
I'm trying to build a form similar to this on that i am using to post this message .
I have the following script that inserts the bbcode when a user selects a text
However i am not getting to reset the cursor at the end of the textarea.value when i
I can't understand why it isnt working
Kendall
I have the following script that inserts the bbcode when a user selects a text
Code: Select all
function storeCaret (textEl) {
if (textEl.createTextRange)
textEl.caretPos = document.selection.createRange().duplicate();
}
function insertTags(text,opentag,closetag){
// get text
if(text.createTextRange)
textSelection = document.selection.createRange().text;
// insert tags
if(textSelection)
document.selection.createRange().text = opentag+textSelection+closetag;
eval(text).focus();
theSelection = '';
return;
storeCaret(eval(text));
}Code: Select all
onClick="insertTags(this.form.aTextArea,'їi]','ї/i]');"I can't understand why it isnt working
Kendall