Javascript-форум (https://javascript.ru/forum/)
-   Общие вопросы Javascript (https://javascript.ru/forum/misc/)
-   -   Калькулятор ошибка подсчета суммы (https://javascript.ru/forum/misc/8614-kalkulyator-oshibka-podscheta-summy.html)

Aquarius 05.04.2010 07:34

Калькулятор ошибка подсчета суммы
 
не могу понять почему не считает сумму, помогите человеки!:(



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Калькулятор</title>
<style type="text/css">
<!--
.forma {
font-family: Arial, Helvetica, sans-serif;
}
body form table {
font-size: 10px;
}
body form table {
font-size: 12px;
}
-->
</style>
</head>

<body>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Andrew Ivantsov (aquarfx@mail.ru) -->



<!-- Begin
function calc1(form) {
//zn=380;
var koll = 1;
var koll = form.koll.valume;
polka = (form.polka.value/1000)+0.06;
cena = polka*(form.dlina.value/1000)*380;
form.cena.value = (cena).toFixed(2);
summa = form.koll.valume*cena;
form.summa.value = (summa).toFixed(2);
}


// End -->
</script>

<form name="form1">
<table width="439" border="0">
<tr>
<td width="231" bgcolor="#CCFFFF"><span class="forma">Длина</span></td>
<td width="103" bgcolor="#CCFFFF"><span class="forma">
<input type="text" name="polka" size=12>
mm</span></td>
<td width="91" bgcolor="#CCFFFF"><span class="forma">
<input type="text" name="cena"
size=12 maxlength=40>
p.</span></td>
</tr>
<tr>
<td height="26" bgcolor="#CCFFFF"><span class="forma">Полка</span></td>
<td bgcolor="#CCFFFF"><span class="forma">
<input type="text" name="dlina" size=12 />
mm</span></td>
<td bgcolor="#CCFFFF">&nbsp;</td>
</tr>
<tr>
<td bgcolor="#CCFFFF"><span class="forma">Количество</span></td>
<td bgcolor="#CCFFFF"><span class="forma">
<input type="text" name="koll" size=12 /></span></td>
<td bgcolor="#CCFFFF"><span class="forma">
<input type="text" name="summa"size=12 maxlength=40></td>
</tr>
<tr>
<td bgcolor="#CCFFFF">&nbsp;</td>
<td bgcolor="#CCFFFF">&nbsp;</td>
<td bgcolor="#CCFFFF">&nbsp;</td>
</tr>
<tr>
<td bgcolor="#CCFFFF">&nbsp;</td>
<td bgcolor="#CCFFFF">&nbsp;</td>
<td bgcolor="#CCFFFF"><span class="forma">
<input type="button" value="Расчитать"
onClick="calc1(this.form)">
</span></td>
</tr>
</table>
</form>
</body>
</html>


не могу понять почему не считает сумму, помогите человеки!:(

x-yuri 05.04.2010 12:06

попробуй заняться отладкой ;)

Aquarius 05.04.2010 13:53

а есть какой нибудь сборник примеров и в чем отладкой заниматься?

Gvozd 05.04.2010 14:09

разумеется
почитайте http://javascript.ru/tutorial/foundation
в частности
http://javascript.ru/tutorial/foundation/errors


Часовой пояс GMT +3, время: 15:05.