Answer the question
In order to leave comments, you need to log in
HTML + JavaScript?
Today I started learning html and javascript. I wrote a small mortgage calculator, but for some reason it does not give a result. Where did I make a mistake?
Answer the question
In order to leave comments, you need to log in
in which books do they teach how to write (use eval)?
a = eval(form.a.value);
here the coding let us down
What is it? Pascal?
? = eval(form.c.value);
s:= z/c;
In general, I advise you to use a debugger. Firebug to the rescue. Or built into Opera or Chrome.
Well, in extreme cases, use alert in the right place.
function calculator(form) {
var a = form.a.value;
var b = form.b.value;
var c = form.c.value;
var d = a*b/100;
var z = a+d;
var s = z/c;
form.total.value = s;
form.plat.value = d
}
this is how it should work
For learning JS, I recommend getting David Flanagan's book "JavaScript. Detailed guide»
For typesetting: Andy Budd «CSS. Professional application of web-standards»
This is of course hard code.
function calculator(form) {
a = eval(form.a.value);
b = eval(form.b.value);
c = eval(form.c.value);
d = a*b/100;
z = a+d;
s = z/c;
form.total.value = s;
form.plat.value = d
}
var a = form.a.value;
varb = form.b.value;
var c = form.c.value;
var d = (a*b/100)*c;
varz = a+d;
vars = z/(c*12);
form.total.value = s;
form.plat.value = d
is more correct like this, but for some reason it does not add a and d, but simply assigns d to a. For example, a=100 d=10, z turns out to be 10010.
How did people learn to program before without the Internet, habra q&a, stackoverflow and others?
I remember a joke that stole is mistaken only once - in choosing a profession
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question