javascript question

Results 1 to 7 of 7

Thread: javascript question

  1. #1
    Sean Guest

    Default javascript question

    Can anyone spot anything wrong with this condition:<BR>if (newdate &#060; newbirthdate+21 && newdate &#062;= newbirthdate+70)<BR> return true;<BR><BR>It doesn&#039;t seem to be working for me. <BR>Cheers!

  2. #2
    Heaven's Martini Guest

    Default RE: javascript question

    what are the variables?<BR><BR>have you tried doing alerts of the values <BR>to see what they are?<BR><BR>and the expressions?

  3. #3
    Sean Guest

    Default RE: javascript question

    The variables are calculated like this:<BR> var newbirthdate = birthdate.valueOf() <BR> newbirthdate = Math.round(newbirthdate/Day)<BR><BR>and my alerts concatenate the number eg: 1212 instead of 24 unless I bracket them thus: (newbirthdate+12)<BR>But this causes me a problem when I bracket them in the function. Any ideas?

  4. #4
    Join Date
    Dec 1969

    Default RE: javascript question

    say newbirthdate = 24...<BR>if (newdate &#060; 35 AND newdate &#062;= 94) return true...<BR><BR>see what i&#039;m getting at?<BR>newdate cannot be less than 35 AND greater than 94... i think you need to say&#062;<BR>if (newdate &#062; newbirthdate+21 && newdate &#060; newbirthdate+70)<BR>return true;<BR><BR>Jason<BR>

  5. #5
    Jason Guest

    Default Of course, || instead of && would work as

    no text

  6. #6
    Sean Guest

    Default that works! Cheers!<eop>.


  7. #7
    Heaven's Martini Guest

    Default RE: javascript question

    yep<BR><BR>where ever you do numeric stuff<BR><BR>put Integervar-0 <BR><BR>(newbirthdate-0 + 12)<BR><BR><BR>( trick to force js to think of the var as a number)

Posting Permissions

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