angst
12-22-2005, 03:46 PM
Hi,
I'm trying to put two scripts together,
first script:
function Add(){
var tx=document.forms[0].TaxAmount;
var ot=document.forms[0].order_total;
var q=document.forms[0].qty;
var c=document.forms[0].price_each;
var t=document.forms[0].amount;
var tt=document.forms[0].TotalTemp;
if (isNaN(q.value)||isNaN(c.value)){
q.value=q.value.replace(/\D/g,'');
c.value=c.value.replace(/\D/g,'');
tx.value=tx.value.replace(/\D/g,'');
ot.value=ot.value.replace(/\D/g,'');
t.value=ot.value.replace(/\D/g,'');
alert('Only Numbers Allowed');
}
if (q.value.length>0&&c.value.length>0){
t.value=parseFloat(q.value) * parseFloat(c.value);
temp = t.value * tx.value / 100;
temp2 = parseFloat(temp) + parseFloat(tt.value) + parseFloat(t.value);
ot.value = Math.round(temp2*100)/100;
}
}
I want to be able to split this value,
var tx=document.forms[0].TaxAmount;
like I've done here:
function TaxDrop(selectIndex) {
var TaxArray=selectIndex.split("|");
document.firstForm.TaxAmount.value = TaxArray[0];
document.firstForm.TaxID.value = TaxArray[1];
}
the problem is, that I need these two scripts to work together.
and right now they just wont work, like the first script Add() to be able to pick up values from TaxDrop, currently I've tried putting the TaxDrop values into hidden text fields, but I guess because there are no user clicks on those fields the Add() script wont pick them up,
can anyone please tell me what I need to do to make this both work together? or just make one script from the two ?
thanks in advance for your time!
-Ken
I'm trying to put two scripts together,
first script:
function Add(){
var tx=document.forms[0].TaxAmount;
var ot=document.forms[0].order_total;
var q=document.forms[0].qty;
var c=document.forms[0].price_each;
var t=document.forms[0].amount;
var tt=document.forms[0].TotalTemp;
if (isNaN(q.value)||isNaN(c.value)){
q.value=q.value.replace(/\D/g,'');
c.value=c.value.replace(/\D/g,'');
tx.value=tx.value.replace(/\D/g,'');
ot.value=ot.value.replace(/\D/g,'');
t.value=ot.value.replace(/\D/g,'');
alert('Only Numbers Allowed');
}
if (q.value.length>0&&c.value.length>0){
t.value=parseFloat(q.value) * parseFloat(c.value);
temp = t.value * tx.value / 100;
temp2 = parseFloat(temp) + parseFloat(tt.value) + parseFloat(t.value);
ot.value = Math.round(temp2*100)/100;
}
}
I want to be able to split this value,
var tx=document.forms[0].TaxAmount;
like I've done here:
function TaxDrop(selectIndex) {
var TaxArray=selectIndex.split("|");
document.firstForm.TaxAmount.value = TaxArray[0];
document.firstForm.TaxID.value = TaxArray[1];
}
the problem is, that I need these two scripts to work together.
and right now they just wont work, like the first script Add() to be able to pick up values from TaxDrop, currently I've tried putting the TaxDrop values into hidden text fields, but I guess because there are no user clicks on those fields the Add() script wont pick them up,
can anyone please tell me what I need to do to make this both work together? or just make one script from the two ?
thanks in advance for your time!
-Ken