codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  caretPos always returning undefined  steph2004 at 19:45 on Monday, October 10, 2005
 

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








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: calling C# from javascript
•  Re: Header Frame ?
•  Adhyayan - Annual Student Conference and Online Coding Festival
•  Re: Gidview row disable
•  Re: Knowing how to get TaylorMade R11 Irons
•  Re: refresh parent after closing pop up window
•  TaylorMade RocketBallz RBZ Driver will travel long and low
•  Supposedly the TaylorMade R11 Irons are supposed
•  TaylorMade R11s Fairway Wood


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2012