javascript question

1. Sean Guest

## 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. Heaven's Martini Guest

## 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. Sean Guest

## 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. Senior Member
Join Date
Dec 1969
Posts
758

## 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>http://www.jasontconnell.com

5. Jason Guest

no text

6. Sean Guest

## that works! Cheers!<eop>.

.

7. Heaven's Martini Guest

## 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>(www.irt.org 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
•