I am very new at Javascript, so this may be to simple for most. Sorry, but I am trying to learn this stuff.
I have a form that has several drop downs for users to select a number from 0 - 100.
Example:
I then add the all the drop down numbers with javascipt.
First I assign each name a variable.
Example:
Then I add all the variables together for a total.
Example:
I probably did this incorrectly, but it works.
Then I make the total equal a form element.
I would like to put in an validation or if statement that would warn the user if the total was over 100.
I tried this but it did not work:
Any assistance would be greatly appreaciated.
Yours,
Dale Rose
I have a form that has several drop downs for users to select a number from 0 - 100.
Example:
Code:
<select name="Ami" onchange="GetTotal()">
<option value=0>0 <option value=10>10 </select>
I then add the all the drop down numbers with javascipt.
First I assign each name a variable.
Example:
Code:
<var Ami = document.week1.Ami.value;
Then I add all the variables together for a total.
Example:
Code:
<var Gtotal = ((-Ami - Bob)* -1);
Then I make the total equal a form element.
I would like to put in an validation or if statement that would warn the user if the total was over 100.
I tried this but it did not work:
Code:
<if (Gtotal > 100) {"alert('Total can not be more than 100!');"} else {document.week1.total.value = Gtotal};
Any assistance would be greatly appreaciated.
Yours,
Dale Rose