Here is the function that is having a problem in Netscape.
function Calculate_OnClick() {
var ie = ((document.all)?true:false);
var RSLaminateCalculator = RSGetASPObject("RSLaminateCalculator.asp");
var request = new String("");
var arrLCRequest = new Array();
var rows = new String("");
var cols = new String("");
var currLine = -1;
var table = document.getElementById("quantityTable");
var row, cell, elem, text, subTable;
var rowInserted = false;
var rowIndex;
//Erase all sub tables
for(i=0;i<table.rows.length;i++) {
if(document.getElementById("quantitySubTable" + i) != null) {
table.deleteRow(document.getElementById("quantitySubTable" + i).parentNode.parentNode.rowIndex - ((ie)?0:1) );
}
}
//Capture data already in the table
GetQuantityTableData(arrLCRequest);
if(arrLCRequest.length == 0) {
alert("Please add at least one calculation.");
return;
}
for(i=0;i<arrLCRequest.length;i++) {
//Check for a valid quantity
if(arrLCRequest.quantity < 1) {
alert("Please enter a quantity greater than 0 for style number " + arrLCRequest.styleNumber);
return;
}
//Build up request string
request += arrLCRequest.patternId + "," +
arrLCRequest.lsnId + "," +
arrLCRequest.quantity;
if(i<arrLCRequest.length-1)
request += "|";
//Reset the sheet array
arrLCRequest.arrLCVendorSheetSize.length = 0;
}
//Calculate yardage synchronously
co = RSLaminateCalculator.calculateYardage(request);
//Check for remote script errors
if(CheckRSErrors(co) == false)
return;
//Insert results into quantity table
rows = String(co.return_value).split("|");
for(i=0;i<rows.length;i++) {
cols = String(rows).split(",");
if(currLine != Number(cols[0])) {
currLine = Number(cols[0]);
//Insert row
//alert("inserting at: " + (document.getElementById("quantityReq" + currLine).rowIndex + ((ie)?1:0)) );
row = table.insertRow(document.getElementById("quantityReq" + currLine).rowIndex + ((ie)?1:0) );
//Insert cell 0
cell = row.insertCell(row.cells.length);
cell.align = "right";
cell.colSpan = "5";
cell.valign = "top";
//Create the sub table and table heads
subTable = document.createElement("table");
subTable.width = "250";
subTable.border = "0";
subTable.cellPadding = "1";
subTable.cellSpacing = "0";
subTable.id = "quantitySubTable" + currLine;
//Append the sub table
cell.appendChild(subTable);
//Insert row
row = subTable.insertRow(subTable.rows.length);
//Insert cell 0
cell = row.insertCell(row.cells.length);
cell.align = "left";
cell.valign = "bottom";
cell.style.border = "1px solid gray";
text = document.createTextNode("Sheet Size");
elem = document.createElement("span");
SetStyleByClass(elem, 0, "Note", "*");
elem.appendChild(text);
cell.appendChild(elem);
//Insert cell 1
cell = row.insertCell(row.cells.length);
cell.align = "left";
cell.valign = "bottom";
cell.style.border = "1px solid gray";
text = document.createTextNode("Quantity");
elem = document.createElement("span");
SetStyleByClass(elem, 0, "Note", "*");
elem.appendChild(text);
cell.appendChild(elem);
insertedRow = false;
}
if(String(cols[1]).indexOf("SHEET SIZE") != -1) {
//Insert row
row = subTable.insertRow(subTable.rows.length);
insertedRow = true;
//Insert cell 0
cell = row.insertCell(row.cells.length);
cell.align = "left";
cell.valign = "bottom";
cell.style.border = "1px solid gray";
text = document.createTextNode(cols[2]);
elem = document.createElement("span");
SetStyleByClass(elem, 0, "DataText", "*");
elem.appendChild(text);
cell.appendChild(elem);
}
if(String(cols[1]).indexOf("SHEET QTY") != -1) {
//Insert cell 1
cell = row.insertCell(row.cells.length);
cell.align = "left";
cell.valign = "bottom";
cell.style.border = "1px solid gray";
text = document.createTextNode(cols[2]);
elem = document.createElement("span");
SetStyleByClass(elem, 0, "DataText", "*");
elem.appendChild(text);
cell.appendChild(elem);
}
}
}
Here is the Add function.
function Add_OnClick() {
var ie = ((document.all)?true:false);
var table = document.getElementById("quantityTable");
var tableHead = document.getElementById("quantityTableHead");
var row, cell, elem, text;
//Check if a model name has been selected
if(document.mainForm.styleNumber.selectedIndex < 0) {
alert("Please select a Style Number.");
return;
}
//Check the number of request. Too many may yield a URL that is too long
//on the return from the calculator
if(table.rows.length == 20) {
alert("You are only allowed 20 calculation requests.");
return;
}
//Add all new requests
for(i=0;i<document.mainForm.styleNumber.length;i++) {
if(document.mainForm.styleNumber.selected) {
row = table.insertRow(table.rows.length);
row.height = "20px";
row.id = "quantityReq" + table.requests;
//Insert cell 0
cell = row.insertCell(row.cells.length);
cell.width = tableHead.rows[0].cells[0].width;
cell.style.border = "1px solid gray";
elem = document.createElement("input");
elem.type = "checkbox";
elem.name = "chk_quantity_" + table.requests;
elem.id = "chk_quantity_" + table.requests;
cell.appendChild(elem);
//Insert cell 1
cell = row.insertCell(row.cells.length);
cell.width = tableHead.rows[0].cells[1].width;
cell.style.border = "1px solid gray";
cell.align = "left";
text = document.createTextNode(String(document.mainForm.styleNumber.text).substring(0, String(document.mainForm.styleNumber.text).indexOf(" ")));
elem = document.createElement("span");
elem.appendChild(text);
elem.id = "quantityStyleNumber" + table.requests;
SetStyleByClass(elem, 0, "DataText", "*");
cell.appendChild(elem);
elem = document.createElement("input");
elem.type = "hidden";
elem.name = "quantityLsnId" + table.requests;
elem.id = "quantityLsnId" + table.requests;
elem.value = document.mainForm.styleNumber.value;
cell.appendChild(elem);
//Insert cell 2
cell = row.insertCell(row.cells.length);
cell.width = tableHead.rows[0].cells[2].width;
cell.style.border = "1px solid gray";
cell.align = "center";
text = document.createTextNode(document.mainForm.laminate[document.mainForm.laminate.selectedIndex].text);
elem = document.createElement("span");
elem.appendChild(text);
elem.name = "quantityLaminateName" + table.requests;
elem.id = "quantityLaminateName" + table.requests;
SetStyleByClass(elem, 0, "DataText", "*");
cell.appendChild(elem);
elem = document.createElement("input");
elem.type = "hidden";
elem.name = "quantityLaminateId" + table.requests;
elem.id = "quantityLaminateId" + table.requests;
elem.value = document.mainForm.laminate[document.mainForm.laminate.selectedIndex].value;
cell.appendChild(elem);
//Insert cell 3
cell = row.insertCell(row.cells.length);
cell.width = tableHead.rows[0].cells[3].width;
cell.style.border = "1px solid gray";
cell.align = "center";
text = document.createTextNode(((Boolean(document.mainForm.directional.value) == true)?'Y':'N'));
elem = document.createElement("span");
elem.appendChild(text);
elem.id = "quantityDirectional" + table.requests;
SetStyleByClass(elem, 0, "DataText", "*");
cell.appendChild(elem);
//Insert cell 4
cell = row.insertCell(row.cells.length);
cell.style.border = "1px solid gray";
cell.align = "center";
elem = document.createElement("input");
elem.type = "text";
elem.name = "quantityQuantity" + table.requests;
elem.id = "quantityQuantity" + table.requests;
elem.value = 1;
elem.style.width = "50px";
elem.height = 12;
elem.style.fontSize = "9px";
elem.style.textAlign = "right";
cell.appendChild(elem);
table.requests++;
}
}
}