Javascript-форум (https://javascript.ru/forum/)
-   Javascript под браузер (https://javascript.ru/forum/css-html/)
-   -   Калькулятор работает ТОЛЬКО в ie6 (вопрос ламера) (https://javascript.ru/forum/css-html/8863-kalkulyator-rabotaet-tolko-v-ie6-vopros-lamera.html)

st_sinner 17.04.2010 16:58

Калькулятор работает ТОЛЬКО в ie6 (вопрос ламера)
 
Вопрос может кому то и покажется ламерским но я нуб:)
Суть в чём... Есть калькулятор... До недавних пор считал и радовал меня... Но в один момент перестал работать под всеми браузерами кроме (сам в шоке) IE6 ! Может кто нибудь подскажет? ПЛЗ... очень сильно надо...
Сам калькулятор лежит тут... если мозила скажет что вирь то прошу прощения... только утром вычищал...
http://potolki-nk.ru/index.php/callc.html
PS
Не знаю имеет ли это значение но CMS joomla!
Мозила в консоле ошибок выдаёт extra1 is null
Собственно сам код...
---------------------------------------------------------------
<script language="JavaScript">
function validate(obj){
if (isNaN(obj.value)) {
obj.value = 0;
} else {
obj.value=parseFloat(parseInt(obj.value*100)/100);
}
}
function toInt(arg){
if (isNaN(arg)) {
return 0;
}
return parseInt(arg);
}
function toFloat(arg){
var a = parseFloat(arg);
if (isNaN(a)) { return 0; }
return a;
}
var fact;
var waitclick = 1;
function ComputeAmount(){
var sq=document.getElementById('square');
var sum = 0;
//var extra_0 = 0;
var extra_1 = 0;
//var extra_2 = 0;
var extra_3 = 0;
var extra_4 = 0;
//var extra_5 = 0;
//var extra_6 = 0;
//var extra_7 = 0;
var extra_8 = 0;

var extra_9 = 0;

//var extra_10 = 0;

//extra_0 = 50;
extra_1 = 400;
//extra_2 = 400;
extra_3 = 300;
extra_4 = 300;
//extra_5 = 870;
//extra_6 = 320;
//extra_7 = 1050;
extra_8 = 500;
extra_9 = 100;
//extra_10 = 400;
//материалы
var sq=document.getElementById('square');
var squarage = toFloat(sq.value);
var factura_option;
var cost =0;
var fo=document.getElementById('factura_options');
factura_option = fo.value; // текущая выбранная фактур
//цены фактур
if (factura_option == 'factura_0_1')
{
if (squarage<14) cost = 700
else if (squarage<20) cost = 600
else if (squarage<31) cost = 550
else cost = 500
}
if (factura_option == 'factura_0_2')
{
if (squarage<6) cost = 700
else if (squarage<14) cost = 600
else if (squarage<20) cost = 550
else if (squarage<31) cost = 500
else cost = 450
}
if (factura_option == 'factura_0_3')
{
if (squarage<6) cost = 600
else if (squarage<14) cost = 500
else cost = 400
}
if (factura_option == 'factura_0_4')
{
if (squarage<6) cost = 600
else if (squarage<14) cost = 500
else cost = 400
}
if (factura_option == 'factura_0_5')
{
if (squarage<6) cost = 500
else if (squarage<14) cost = 400
else cost = 300
}
//цены фактур
sum +=(cost*squarage);
// if (sum<9000) sum = 9000
//материалы
//углы
var costugol=0;
var ug=document.getElementById('ugol');
var ugolok = toInt(ug.value);
if (ugolok>4) costugol = 200;
if (ugolok>4) costugol=costugol*(ugolok-4);
sum +=costugol;
//углы
//var extra0=document.getElementById('extra0');
//sum += parseFloat(extra_0)*parseInt(extra0.value);
var extra1=document.getElementById('extra1');
sum += parseFloat(extra_1)*parseInt(extra1.value);
//var extra2=document.getElementById('extra2');
//sum += parseFloat(extra_2)*parseInt(extra2.value);
var extra3=document.getElementById('extra3');
sum += parseFloat(extra_3)*parseInt(extra3.value);
var extra4=document.getElementById('extra4');
sum += parseFloat(extra_4)*parseInt(extra4.value);
//var extra5=document.getElementById('extra5');
//sum += parseFloat(extra_5)*parseInt(extra5.value);
//var extra6=document.getElementById('extra6');
//sum += parseFloat(extra_6)*parseInt(extra6.value);
//var extra7=document.getElementById('extra7');
//sum += parseFloat(extra_7)*parseInt(extra7.value);
var extra8=document.getElementById('extra8');
sum += parseFloat(extra_8)*parseInt(extra8.value);
var extra9=document.getElementById('extra9');
sum += parseFloat(extra_9)*parseInt(extra9.value);
//var extra10=document.getElementById('extra10');
//sum += parseFloat(extra_10)*parseInt(extra10.value);
var outsum=document.getElementById('outsum');
var errorinp=document.getElementById('errorinp');
if (sum<0)
{
errorinp.style.visibility = 'visible'
}
else
{
outsum.value = sum;
errorinp.style.visibility = 'hidden'
}
}

JsLoveR 17.04.2010 17:33

st_sinner,
Я в коде не вижу ошибок, возможно у вас нету элемента с id="extra1"

st_sinner 17.04.2010 17:53

Да действительно:) нет... Сейчас попробую вставить:)

JsLoveR 17.04.2010 18:11

st_sinner,
У Вас ещё нету элементов с id="extra4", id="extra9" в html коде


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