Results 1 to 3 of 3

Thread: charAt

  1. #1

    Thread Starter
    Hyperactive Member richy's Avatar
    Join Date
    Jan 1999
    Location
    Liverpool, England
    Posts
    353
    Can anybody tell me what is wrong with the following code. I found out about the charAt function from the webreference website (http://webreference.com/js/tips/000227.html) but I keep getting the output as undefined.
    The first alert responds with the correct value, but on the second alert that's when I get the undefined.


    alert(s.value);
    var tmpstring=s.value;
    alert(tmpstring.charAt[2]);

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    you should have round brackets for chatAt


    alert(tmpstring.charAt(2));
    Mark
    -------------------

  3. #3

    Thread Starter
    Hyperactive Member richy's Avatar
    Join Date
    Jan 1999
    Location
    Liverpool, England
    Posts
    353
    the simplest of things....

    cheers very much that worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width