Hi,
Here's a script I'm working on that's giving me fits:
====================================
function removeRow(num) {
var frm = document.forms[0];
var num = new Number(num);
var yearsNum = new Number(frm.NumYears.value);
var divNames = buildArray("DIV", /d\d\d\da/);
var fromLen = divNames.length;
writeFirstValues(fromLen);
var seeNSNarray = getVisibleNSNs();
var seeNSNnums = new Array();
for(var x=0; x < (seeNSNarray.length); x++) {
seeNSNnums[x] = new Number(seeNSNarray[x].id.slice(3));
}
***alert(seeNSNnums[1]==5);
***alert(num==5);
***alert(seeNSNnums[1]==num);
***for(var y=0; y < (seeNSNnums.length); y++) {
***if(seeNSNnums[y] == num) {var valid=true; alert(true);}
***}
***if(!valid) {alert("Please enter the number of a row containing an NSN."); return false;}
frm.NSN.value=(frm.NSN.value-1);
removed = NSN_value.splice((num-1), yearsNum);
removed = FY.splice((num-1), yearsNum);
removed = TotalQty.splice((num-1), yearsNum);
removed = MinQty.splice((num-1), yearsNum);
removed = MaxQty.splice((num-1), yearsNum);
removed = Centra.splice((num-1), yearsNum);
removed = CgCode.splice((num-1), yearsNum);
removed = RevLetter.splice((num-1), yearsNum);
removed = AMRC.splice((num-1), yearsNum);
removed = TobyBid.splice((num-1), yearsNum);
writeTable();
};
===========================
The six lines where I've added *** are the problem lines here. Notice that I have three alert functions, testing whether a variable is equal to five, then whether a second variable is also equal to five, then finally whether the first variable and second variable are equal to each other. I then set a flag variable if the two variables are equal that I use to validate the function.
When I pass five as my function parameter (num), the alert messages come back "true", "true", and "false". How can this be!? Both variable should be the same variable type (number), and I can't see anything else that would affect this. I am completely bamboozled...help!
Sam
Here's a script I'm working on that's giving me fits:
====================================
function removeRow(num) {
var frm = document.forms[0];
var num = new Number(num);
var yearsNum = new Number(frm.NumYears.value);
var divNames = buildArray("DIV", /d\d\d\da/);
var fromLen = divNames.length;
writeFirstValues(fromLen);
var seeNSNarray = getVisibleNSNs();
var seeNSNnums = new Array();
for(var x=0; x < (seeNSNarray.length); x++) {
seeNSNnums[x] = new Number(seeNSNarray[x].id.slice(3));
}
***alert(seeNSNnums[1]==5);
***alert(num==5);
***alert(seeNSNnums[1]==num);
***for(var y=0; y < (seeNSNnums.length); y++) {
***if(seeNSNnums[y] == num) {var valid=true; alert(true);}
***}
***if(!valid) {alert("Please enter the number of a row containing an NSN."); return false;}
frm.NSN.value=(frm.NSN.value-1);
removed = NSN_value.splice((num-1), yearsNum);
removed = FY.splice((num-1), yearsNum);
removed = TotalQty.splice((num-1), yearsNum);
removed = MinQty.splice((num-1), yearsNum);
removed = MaxQty.splice((num-1), yearsNum);
removed = Centra.splice((num-1), yearsNum);
removed = CgCode.splice((num-1), yearsNum);
removed = RevLetter.splice((num-1), yearsNum);
removed = AMRC.splice((num-1), yearsNum);
removed = TobyBid.splice((num-1), yearsNum);
writeTable();
};
===========================
The six lines where I've added *** are the problem lines here. Notice that I have three alert functions, testing whether a variable is equal to five, then whether a second variable is also equal to five, then finally whether the first variable and second variable are equal to each other. I then set a flag variable if the two variables are equal that I use to validate the function.
When I pass five as my function parameter (num), the alert messages come back "true", "true", and "false". How can this be!? Both variable should be the same variable type (number), and I can't see anything else that would affect this. I am completely bamboozled...help!
Sam
Comment