variables

They have: 2 posts

Joined: Nov 1999

HELP!!!!

I´m trying to make an exchanger for my page. It will allow me to write a number in a form and then press a button and multiply the number with 8,24 and then print it in a another textframe in the same form.

code
-------
<SCRIPT Language="JavaScript">

funktion Change(){
var in = document.exchange.var1.value;
var ut = in*8,24;
document.exchange.var2.value = ut + "";
}
</SCRIPT>

body section
-----------
<form action="" method=POST name=exchange>
<input type="text" value="" name="var1">
<br>
<input type="button" value="växla" name="button1" onClick="Change()">
<br>
<input type="text" value="" name="var2">
<br>
</form>

[This message has been edited by trullec (edited 30 November 1999).]

/trullec

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

Try changing:

var ut = in*8,24;
to:
var ut = in*8.24;

I'm not sure that's it, but it may be JavaScript needs the number in the decimal version (though I know the comma means decimal in many areas). But then, it may not be it, it depends on the browser.

They have: 2 posts

Joined: Nov 1999

thanks but I tried with
ut=in*8;
and that didn´t work either

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.