SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What's wrong with this picture???

    Can anyone tell me why this code is acting like this? I'm using VS 2010. There are a ton of other functions in this library that use the .indexOf() object with no problems. I don't know what I'm doing wrong here. I've research the .indexOf() object and I'm using it as I've seen used in book and online examples.

    Please see attached GIF Image.

    Thanks,
    Attached Images Attached Images

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by rsmldmv View Post
    Can anyone tell me why this code is acting like this? I'm using VS 2010. There are a ton of other functions in this library that use the .indexOf() object with no problems. I don't know what I'm doing wrong here.
    What's going wrong is that you are trying to use it on an element, when it should be used on a string or (if using JavaScript v1.6 or better) on arrays.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Paul,

    I'm not real good with Javascript. Something I tried and still didn't work was when I declared the variable "result", I redid the statement like this:

    var result = "";

    What should it be?

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by rsmldmv View Post
    What should it be?
    From what you're doing with the num1 variable, it seems that it should be the value of the field, rather than a reference to the field itself.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

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