Hi all,
I am pretty stuck on something so simple its untrue. I never really learnt javascript properly and the stuff i did learn was quite basic. I hope you can help me.
I have a form, with an input box. The user is required to input a value, which will be converted and then output as 4 different values. Here’s an example of what i mean:
[CODE]
function calculate() {
var dummy1 = 600;
var dummy2= 700;
var dummy3 = 500;
var dummy4 = 250;
var userValue;
var newDummy1;
var newDummy2;
var newDummy3;
var newDummy4;
userValue = parseFloat(document.myForm.myInputBoxName.value);
userValue = (userValue*1000)*1000;
newDummy1 = userValue*dummy1;
newDummy2 = userValue*dummy2;
newDummy3 = userValue*dummy3;
newDummy4 = userValue*dummy4;
}
So basically the user value is taken as a string, converted to a floating point and then multiplied by a bunch of numbers which are assigned to variables – I need these 4 variables to be shown in a table which is below the form. My question is, basically, HOW!! It’s very simple I know, but I just dont know how to do it and I havent had much luck looking at examples as they dont really teach, they just do, if that makes sense.
I really hope someone can help me – please explain as much as possible – I am a complete novice at JavaScript.
Thanks in advance and I hope for a quick reply as I need to have this finished at work 2moro! (I’m going home now – you have one evening – no pressure hee hee)
Theo