hi ,
I am trying to add to an existing script. this script is an “online estimator” for my carpet cleaning customers.I want to make it more elaborate. i want them to be able to enter the type of carpeting they have and then have that translate into what it would cost per square foot to clean. right now it is pretty generic if someone could get me going in the right direction it would be greatly appreciated. here is the code i have:
function conv_number(expr, decplaces)
{ // This function is from David Goodman’s Javascript Bible.
var str = “” + Math.round(eval(expr) * Math.pow(10,decplaces));
while (str.length <= decplaces) {
str = “0” + str;
}
var decpoint = str.length – decplaces;
return (str.substring(0,decpoint) + “.” + str.substring(decpoint,str.length));
}
function room(Form) {
a1 = document.myform.length1.value;
b1 = document.myform.width1.value;
f1 = 0;
a2 =document.myform.length2.value;
b2 = document.myform.width2.value;
f2 = 0;
a3 = document.myform.length3.value;
b3 = document.myform.width3.value;
f3 = 0;
a4 = document.myform.length4.value;
b4 = document.myform.width4.value;
f4 = 0;
a5 = document.myform.length5.value;
b5 = document.myform.width5.value;
f5 = 0;
a6 = document.myform.length6.value;
b6 = document.myform.width6.value;
f6 = 0;
a7 = document.myform.length7.value;
b7 = document.myform.width7.value;
f7 = 0;
a8 = document.myform.length8.value;
b8 = document.myform.width8.value;
f8 = 0;
a9 = document.myform.length9.value;
b9 = document.myform.width9.value;
f9 = 0;
a10 = document.myform.length10.value;
b10 = document.myform.width10.value;
f10 = 0;
if (isNaN(a1)) {
alert(“OOPS! ” + document.myform.length1.value + ” is not a number”);
}
else {
c1 = a1*b1;
}
if (isNaN(b1)) {
alert(“OOPS! ” + document.myform.width1.value + ” is not a number”);
}
else {
c1 = a1*b1;
}
d1 = c1*(.0);
e1 = c1 + d1;
document.myform.carpet1.value = Math.round(e1);
f1 = e1*.318;
document.myform.total1.value = conv_number(f1,2);
g = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10;
document.myform.total.value = conv_number(g,2);
c2 = a2*b2
d2 = c2*(.0)
e2 = c2 + d2
document.myform.carpet2.value = Math.round(e2);
f2 = e2*.318;
document.myform.total2.value = conv_number(f2,2);
g = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10;
document.myform.total.value = conv_number(g,2);
c3 = a3*b3;
d3 = c3*(.0)
e3 = c3 + d3
document.myform.carpet3.value = Math.round(e3);
f3 = e3*.318;
document.myform.total3.value = conv_number(f3,2);
g = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10;
document.myform.total.value = conv_number(g,2);
c4 = a4*b4;
d4 = c4*(.0)
e4 = c4 + d4
document.myform.carpet4.value = Math.round(e4);
f4 = e4*.318;
document.myform.total4.value = conv_number(f4,2);
g = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10;
document.myform.total.value = conv_number(g,2);
c5 = a5*b5;
d5 = c5*(.0)
e5 = c5 + d5
document.myform.carpet5.value = Math.round(e5);
f5 = e5*.318;
document.myform.total5.value = conv_number(f5,2);
g = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10;
document.myform.total.value = conv_number(g,2);
c6 = a6*b6;
d6 = c6*(.0)
e6 = c6 + d6
document.myform.carpet6.value = Math.round(e6);
f6 = e6*.530;
document.myform.total6.value = conv_number(f6,2);
g = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10;
document.myform.total.value = conv_number(g,2);
c7 = a7*b7;
d7 = c7*(.0)
e7 = c7 + d7;
document.myform.carpet7.value = Math.round(e7);
f7 = e7*.530;
document.myform.total7.value = conv_number(f7,2);
g = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10;
document.myform.total.value = conv_number(g,2);
c8 = a8*b8;
d8 = c8*(.0)
e8 = c8 + d8;
document.myform.carpet8.value = Math.round(e8);
f8 = e8*.530;
document.myform.total8.value = conv_number(f8,2);
g = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10;
document.myform.total.value = conv_number(g,2);
c9 = a9*b9;
d9 = c9*(.0)
e9 = c9 + d9
document.myform.carpet9.value = Math.round(e9);
f9 = e9*.530;
document.myform.total9.value = conv_number(f9,2);
g = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10;
document.myform.total.value = conv_number(g,2);
c10 = a10*b10;
d10 = c10*(.0)
e10 = c10 + d10
document.myform.carpet10.value = Math.round(e10);
f10 = a10*2.65;
document.myform.total10.value = conv_number(f10,2);
g = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 ;
document.myform.total.value = conv_number(g,2);
}
//–>
</script>