|
Hi,
Can someone tell me why caretPos always return "undefined"? It's a function to add smileys to my webpage and it's almost the same than many forums on the internet. It does the same error with IE 6 and Firefox.
Here's my function:
function addSmiley(text) {
var tArea = document.post.message;
text = ' ' + text + ' ';
if (tArea.createTextRange && tArea.caretPos) {
var caretPos = tArea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
txtarea.focus();
} else {
tArea.value += text;
tArea.focus();
}
}
Thanks for any help!
Steph
|
|
|
|
|
|
|
|