I am using an online form with calculation done in Javascript that someone else started. I have used it on two different sites for a shopping cart type effect, but with the second site I am only able to add a certain number of items and then the form will not submit in IE for PC. Up until a certain number I haven't yet determined, it works fine, but I hit a point where you click Submit and it does nothing. Works just fine on a Mac though! If it helps, a working version of this script is on
Here is a condensed version; note I first have a script for a popup window, but that does not seem to interfere.
<script language=Javascript>
<!-- HIDE FROM OLD BROWSERS
browser = navigator.appName; // detect browser
ver = parseInt(navigator.appVersion); // detect version#
function openphoto(html) {
open_window =
window.open(html,"photo",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=0,width=400,height=400');
if ((browser=="Microsoft Internet Explorer" && ver<=3) || (ver<3)) {
} else {
open_window.focus();
}
}
var NumItems;
function roundOff(value) {
value = "" + value //convert value to string
precision = 2;
var whole = "" + Math.round(value * Math.pow(10, precision));
var decPoint = whole.length - precision;
if(decPoint != 0) {
result = whole.substring(0, decPoint);
result += ".";
result += whole.substring(decPoint, whole.length);
} else {
result = whole;
}
if (result.length < 7) {
for (x=result.length;x<7;x++) {
result = " " + result
}
} return result;
}
function getnum(s) {
var s1;
s1 = parseInt(s);
//alert("[" + s.substring(0,1) + "]"
if (s.substring(0,1) == " " return 0;
if (s1 < 1 || s1 > 99) return 0;
if (s == "" return 0;
NumItems = NumItems + parseInt(s1);
return (s1);
}
function isaPosNum(s) {
return (parseInt(s) > -1)
}
function addAll(orderform,check) {
var Mdenim
var Ldenim
var Subtotal
var Tax
var Total
<!--INDIVIDUAL ITEMS-->
NumItems = 0;
Mdenim = ((getnum(orderform.Denim_MensLS_Med.value) + getnum(orderform.Denim_MensSS_3X.value)) * 50);
Ldenim = ((getnum(orderform.Denim_WomensLS_Sm.value) + getnum(orderform.Denim_WomensSS_XL.value)) * 45);
<!--SUBTOTAL-->
Subtotal = (Mdenim + Ldenim);
orderform.Subtotal.value = roundOff(Subtotal);
<!--TAX-->
Tax = 0
if (orderform.STATE.selectedIndex == 9) {
Tax = Subtotal * 0.07;
orderform.TAX.value = roundOff(Tax);
}
Total = Subtotal + Tax
orderform.AMOUNT.value = roundOff(Total);
if (check == true ) {
if (NumItems == 0 ) {
alert("Please choose some items to purchase"
return false;
}
if (orderform.NAME.value == "" ) {
alert("Please Enter your NAME"
return false;
}
if (orderform.ADDRESS.value == "" ) {
alert("Please enter your ADDRESS"
return false;
}
if (orderform.CITY.value == "" ) {
alert("Please enter your CITY"
return false;
}
if (orderform.STATE.selectedIndex == 0) {
alert("Please enter your STATE "
return false;
}
if (orderform.ZIP.value == "" ) {
alert("Please enter your ZIP"
return false;
}
if (orderform.EMAIL.value == "" ) {
alert("Please enter your EMAIL"
return false;
}
if (orderform.PHONE.value == "" ) {
alert("Please enter your PHONE"
return false;
}
}
return true;
}
// Stop hiding from old browsers -->
</script>
Here is a condensed version; note I first have a script for a popup window, but that does not seem to interfere.
<script language=Javascript>
<!-- HIDE FROM OLD BROWSERS
browser = navigator.appName; // detect browser
ver = parseInt(navigator.appVersion); // detect version#
function openphoto(html) {
open_window =
window.open(html,"photo",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=0,width=400,height=400');
if ((browser=="Microsoft Internet Explorer" && ver<=3) || (ver<3)) {
} else {
open_window.focus();
}
}
var NumItems;
function roundOff(value) {
value = "" + value //convert value to string
precision = 2;
var whole = "" + Math.round(value * Math.pow(10, precision));
var decPoint = whole.length - precision;
if(decPoint != 0) {
result = whole.substring(0, decPoint);
result += ".";
result += whole.substring(decPoint, whole.length);
} else {
result = whole;
}
if (result.length < 7) {
for (x=result.length;x<7;x++) {
result = " " + result
}
} return result;
}
function getnum(s) {
var s1;
s1 = parseInt(s);
//alert("[" + s.substring(0,1) + "]"
if (s.substring(0,1) == " " return 0;
if (s1 < 1 || s1 > 99) return 0;
if (s == "" return 0;
NumItems = NumItems + parseInt(s1);
return (s1);
}
function isaPosNum(s) {
return (parseInt(s) > -1)
}
function addAll(orderform,check) {
var Mdenim
var Ldenim
var Subtotal
var Tax
var Total
<!--INDIVIDUAL ITEMS-->
NumItems = 0;
Mdenim = ((getnum(orderform.Denim_MensLS_Med.value) + getnum(orderform.Denim_MensSS_3X.value)) * 50);
Ldenim = ((getnum(orderform.Denim_WomensLS_Sm.value) + getnum(orderform.Denim_WomensSS_XL.value)) * 45);
<!--SUBTOTAL-->
Subtotal = (Mdenim + Ldenim);
orderform.Subtotal.value = roundOff(Subtotal);
<!--TAX-->
Tax = 0
if (orderform.STATE.selectedIndex == 9) {
Tax = Subtotal * 0.07;
orderform.TAX.value = roundOff(Tax);
}
Total = Subtotal + Tax
orderform.AMOUNT.value = roundOff(Total);
if (check == true ) {
if (NumItems == 0 ) {
alert("Please choose some items to purchase"
return false;
}
if (orderform.NAME.value == "" ) {
alert("Please Enter your NAME"
return false;
}
if (orderform.ADDRESS.value == "" ) {
alert("Please enter your ADDRESS"
return false;
}
if (orderform.CITY.value == "" ) {
alert("Please enter your CITY"
return false;
}
if (orderform.STATE.selectedIndex == 0) {
alert("Please enter your STATE "
return false;
}
if (orderform.ZIP.value == "" ) {
alert("Please enter your ZIP"
return false;
}
if (orderform.EMAIL.value == "" ) {
alert("Please enter your EMAIL"
return false;
}
if (orderform.PHONE.value == "" ) {
alert("Please enter your PHONE"
return false;
}
}
return true;
}
// Stop hiding from old browsers -->
</script>