Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    eval bug.. ?!?!? eval method not working properly

    can someone please explain to me why this eval statement:

    eval("var sTime = frmTimesheet." + datesArray[x] + "-startTime.value;");

    returns an error - Expected ';'

    ?????

    I have looked at this 100 ways and just don't know what is going on.. the best I have come up with is that its something to do with [x] but why, I do not know!!!


    help please.

    thx.
    Thought is the most powerful force in the universe
    - whisk

  • #2
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok 2 things I didn't know...

    first you can't have a value attribute starting with numbers.. in my example dateArray[x] is a string of numbers...

    secondly you can't have '-' character in a value attribute..

    I never realized that value's are very much like c variables.. can't believe it to me so long to figure out
    Thought is the most powerful force in the universe
    - whisk

  • #3
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts

    Re: eval bug.. ?!?!? eval method not working properly

    var sTime = frmTimesheet[datesArray[x] + '-startTime'].value;

  • #4
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Re: eval bug.. ?!?!? eval method not working properly

    Originally posted by jkd
    var sTime = frmTimesheet[datesArray[x] + '-startTime'].value;
    na.. its fixed now.. didn't you read the second post??.. the way you have replied probably wont work either... anyways I changed:

    eval("var sTime = frmTimesheet." + datesArray[x] + "-startTime.value;");

    to this:

    eval("var sTime = frmTimesheet.startTime_" + datesArray[x] + ".value;");

    works fine now.. but thanks anyway.
    Thought is the most powerful force in the universe
    - whisk

  • #5
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts

    Re: Re: Re: eval bug.. ?!?!? eval method not working properly

    Originally posted by whisk
    the way you have replied probably wont work either... anyways I changed:
    You're going to call me wrong without even trying it? All properties in Javascript are also made available through a hash, which accepts string arguments. some-thing may not be a valid property name, but it is a perfectly fine string.

  • #6
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Re: Re: Re: eval bug.. ?!?!? eval method not working properly

    Originally posted by jkd
    You're going to call me wrong without even trying it? All properties in Javascript are also made available through a hash, which accepts string arguments. some-thing may not be a valid property name, but it is a perfectly fine string.
    I said your probably wrong.. anywho.. I tried your method and it didn't work :P
    Thought is the most powerful force in the universe
    - whisk

  • #7
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts

    Re: Re: Re: Re: Re: eval bug.. ?!?!? eval method not working properly

    Originally posted by whisk
    I said your probably wrong.. anywho.. I tried your method and it didn't work :P
    It works fine. Obviously there is something else wrong with your code. You don't need to be rude you know, forums are a friendly setting.

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Re: Re: Re: Re: Re: eval bug.. ?!?!? eval method not working properly

    Originally posted by jkd
    It works fine. Obviously there is something else wrong with your code.
    That sounds frighteningly similar to the reply I gave to someone else a couple of days ago, that apparently *didn't* try my solution, and just assumed I was wrong because of a typo in a tutorial.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #9
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    in the context of this thread I'm right and your wrong.. stop being such a super moderator
    Thought is the most powerful force in the universe
    - whisk

  • #10
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Originally posted by whisk
    in the context of this thread I'm right and your wrong.. stop being such a super moderator
    ... how old are you?

  • #11
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Actually no. This thread is going to deteriorate. A solution has been presented, and you seem to have arrived at your own, so this thread has served its purpose.

    PM me if you feel you must continue your immaturity.

    In the mean time, this thread is closed.


  •  

    Posting Permissions

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