Re: javascript type cast
| From: | Josh Close | Date: | Tue, 03 Aug 2004 16:35:45 +0000 |
| Subject: | Re: javascript type cast | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-192543@lists.php.net to get a copy of this message | ||
.......I found you can do var*1 to get it to type cast.
Thanks.
-Josh
On Tue, 3 Aug 2004 11:28:16 -0500, Josh Close <narshe@gmail.com> wrote:
> Is there any way to do a typecast in javascript? I know you can in
> 2.0, but that won't work here.
>
> I have an input field and I need to add a number to it's value.
>
> var + 123 == 'var123'
>
> You would think that it would automatically typecast var to an int
> since it's being added to one, but it just concatenates it instead.
>
> How can I add (or sum) the two values?
>
> P.S. I'm doing this in a php page... that's why I'm asking here.
>
> -Josh
>