General Car Related Discussion. To discuss anything that is related to cars and automotive technology that doesnt naturally fit into another forum catagory.

javascript help needed please

Thread Tools
 
Search this Thread
 
Old May 16, 2008 | 11:42 AM
  #1  
foreigneRS's Avatar
foreigneRS
Thread Starter
Testing the future
 
Joined: Jul 2003
Posts: 17,597
Likes: 24
From: W. Sussex
Default javascript help needed please

i need help with some javascript that is probably so simple that you will laugh at me

i am teaching myself javascript for my website, so that i can include some calculators for working out mpg, mileage to payback remap costs etc.

most of it is all working fine, particularly those functions involving variables that are multiplied, for example x = (y*z)

but i can't get a simple one like x =(y+z) to work

if i check with an alert, the numerical values for y and z are as they should be (for example 10 and 20), but then x comes out as 1020 rather than 30

it's doing my head in, please help

Last edited by foreigneRS; May 16, 2008 at 12:45 PM.
Reply
Old May 16, 2008 | 01:48 PM
  #2  
foreigneRS's Avatar
foreigneRS
Thread Starter
Testing the future
 
Joined: Jul 2003
Posts: 17,597
Likes: 24
From: W. Sussex
Default

solved it now

but perhaps not very elegant.

in x = (y+z) it was basically treating the z as a string, rather than a value. by writing x = ((y+(z*1)) it works
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JoeyBoyden
Restorations, Rebuilds & Projects.
26
Jan 4, 2024 02:36 PM
jessie_rs
Ford RS Cosworth Parts for Sale
11
Jun 3, 2019 04:57 PM
borboyous
Cars for Sale
6
Aug 22, 2015 11:17 AM
col93saphcos
Ford Sierra/Sapphire/RS500 Cosworth
5
Aug 7, 2015 03:21 PM




All times are GMT. The time now is 07:11 AM.