Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Expressions help

Reply
Thread Tools

Expressions help

 
 
mwh
Guest
Posts: n/a
 
      05-05-2005
Hi.

I am using Javascript to make a kind of calculator. I am trying to do
addition, but when I use it, it just displays the numbers together, not
added together. Example:
function additionCalculator(num1, num2){
var total = num1 + num2
return total
}

I try to add the numbers, but it just puts them together.

Also, I am trying to use subtraction and division, but I do not know
how.

Can anybody help?

(____)
(\/)
/-------\/
/ | Mwh ||
- ||----||

 
Reply With Quote
 
 
 
 
Gazza
Guest
Posts: n/a
 
      05-05-2005


mwh mumbled the following on 05/05/2005 02:21:
> Hi.
>
> I am using Javascript to make a kind of calculator. I am trying to do
> addition, but when I use it, it just displays the numbers together, not
> added together. Example:
> function additionCalculator(num1, num2){
> var total = num1 + num2
> return total
> }
>
> I try to add the numbers, but it just puts them together.
>
> Also, I am trying to use subtraction and division, but I do not know
> how.
>
> Can anybody help?


Amazing what you can find if you type in Javascript adding numbers into
Google...
http://homepage.ntlworld.com/kayseyc...ariables4.html


--
Gazza
Mobile Number Network Checker - http://mnnc.net/
Creative writing & Poems - http://garyjones.co.uk/
Leovanna Leonbergers - http://leovanna.co.uk/
 
Reply With Quote
 
 
 
 
nice.guy.nige
Guest
Posts: n/a
 
      05-05-2005
While the city slept, mwh ((E-Mail Removed)) feverishly typed...

> Hi.
>
> I am using Javascript to make a kind of calculator. I am trying to do
> addition, but when I use it, it just displays the numbers together,
> not added together.

[...]

From the FAQ's for the news:comp.lang.javascript newsgroup
(http://www.jibbering.com/faq/), the following should help;

4.21 Why does 1+1 equal 11? or How do I convert a string to a number?
http://www.jibbering.com/faq/#FAQ4_21

Hope that helps,
Nige

--
Nigel Moss http://www.nigenet.org.uk
Mail address will bounce. http://www.velocityreviews.com/forums/(E-Mail Removed) | Take the DOG. out!
"Your mother ate my dog!", "Not all of him!"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expressions help needed Andreas Klemt ASP .Net 0 08-17-2004 11:04 AM
Add custom regular expressions to the validation list of available expressions Jay Douglas ASP .Net 0 08-15-2003 10:19 PM
Regular Expressions....HELP! Stephajn Craig ASP .Net 1 07-16-2003 06:56 PM
Re: Help with regular expressions. Chris R. Timmons ASP .Net 0 07-04-2003 10:49 PM
Re: Help with regular expressions. David Waz... ASP .Net 0 07-04-2003 08:59 PM



Advertisments