4fit?
10-10-2006, 12:51 PM
I have a JavaScript validation function that checks to make sure that each combobox has had a selection made in it. Here is that code:
function checkform() {
var TWIndex=document.TireDiameterForm.TireWidth.selectedIndex;
var SWIndex=document.TireDiameterForm.SideWall.selectedIndex;
var WDIndex=document.TireDiameterForm.WheelDiameter.selectedIndex;
if (TWIndex==0){
alert('There is a problem with the Tire Width field');
return false;}
else if (SWIndex==0) {
alert('There is a problem with the Sidewall field');
return false;}
else if (WDIndex==0) {
alert('There is a problem with the Wheel Diameter field');
return false;}
return true;
}
If this function returns true, I want this additional function to run. How do I do this? Thanks in advance.
function TireDiameter() {
var mm=.0393701
var w = document.TireDiameterForm.TireWidth.value;
var s = document.TireDiameterForm.SideWall.value;
var d = document.TireDiameterForm.WheelDiameter.value;
var y = Math.round((((((w * s) / 100) * 2) * mm) + (d * 1)) * 100) / 100;
document.TireDiameterForm.Result.value = y;}
function checkform() {
var TWIndex=document.TireDiameterForm.TireWidth.selectedIndex;
var SWIndex=document.TireDiameterForm.SideWall.selectedIndex;
var WDIndex=document.TireDiameterForm.WheelDiameter.selectedIndex;
if (TWIndex==0){
alert('There is a problem with the Tire Width field');
return false;}
else if (SWIndex==0) {
alert('There is a problem with the Sidewall field');
return false;}
else if (WDIndex==0) {
alert('There is a problem with the Wheel Diameter field');
return false;}
return true;
}
If this function returns true, I want this additional function to run. How do I do this? Thanks in advance.
function TireDiameter() {
var mm=.0393701
var w = document.TireDiameterForm.TireWidth.value;
var s = document.TireDiameterForm.SideWall.value;
var d = document.TireDiameterForm.WheelDiameter.value;
var y = Math.round((((((w * s) / 100) * 2) * mm) + (d * 1)) * 100) / 100;
document.TireDiameterForm.Result.value = y;}