[thelist] javascript comparison

Simon Perry simon.perry at si-designs.co.uk
Wed Oct 29 12:41:19 CST 2003


----- Original Message ----- 
From: "Rob Smith"
> Hi,
>
> My javascript test is testing supposedly numerical values as strings, when
> they should be compared by actual value.
>
> Javascript function:
> --------------------------
>
Hi,

This should work...

Simon

 if (( parseInt(bid.previousbid.value)) > (parseInt(bid.nextbid.value)) ) {

>   alert("Please enter a bid greater than $" + bid.previousbid.value +
".");
>   return false;
>   } else {
>   document.bid.submit();
>   return true;
> }
>
>
> Form Data:
> --------------------------
>
> Initial Bid: <input type="hidden" name="previousbid"
> value=<%=RS.fields.item("LatestBid").value%>>
> Minimum Bid: <input name="nextbid" type="text"
> value=<%=RS.fields.item("LatestBid").value+1%> size="4">
>
>
> Sample test:
> --------------------------
>
> Initial Bid: $ 5
> Minimum Bid: $ 10
>
>
> Error Message
> --------------------------
>
> Please enter a bid greater than $5.
>  (... I did.)
>
>
> Is there a way I can cast values in javascript?
>
> Rob.Smith
> -- 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>
>



More information about the thelist mailing list