title: Javascript Validate Text Boxes with Error IF all three text boxes <> then 100%
body: <p>I have a Form which contains 4 text boxes, I need help with validation.</p>
  
  <p>I need that the total combined value be = 100%, if less or greater then show error.</p>
  
  <p>e.g.  </p>
  
  <p>Box 1 user enters 50%, Box 2 user enters 30% and Box 3 user enters 19%.
  Box 4, would hold the total value of box 1,2 and 3 ie Total 99%
  When the user clicks submit, it should validate and return error eg, total not equal to 100%
  Same goes if the total of box 4 is > the 100%</p>
  
  <p>At the moment i have it calculating the total value for box 4, but not sure how to do the validation! </p>
  
  <pre><code>    &lt;SCRIPT language="JavaScript"&gt;
  
  function CalculateCardT()
  {
      formSectionA.CardTotal.value = 
  
  parseFloat(formSectionA.strPercDeferredGoods.value) + parseFloat(formSectionA.strPercDeposits.value) + parseFloat(formSectionA.strPercSubscriptions.value);
  
  
      }
      &lt;/SCRIPT&gt;
  
  
            &lt;tr&gt;
          &lt;td rowspan="2" nowrap="nowrap"&gt; % of CARD turnover&lt;/td&gt;
          &lt;td nowrap="nowrap"&gt;% Deferred delivery of goods&lt;/td&gt;
          &lt;td nowrap="nowrap"&gt;% Deposit is taken&lt;/td&gt;
          &lt;td nowrap="nowrap"&gt;% Subscriptions&lt;/td&gt;
          &lt;td nowrap="nowrap"&gt;% Total&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td nowrap="nowrap"&gt;
            &lt;input name="strPercDeferredGoods" type="text" required="required" id="strPercDeferredGoods" tabindex="6" onBlur="CalculateCardT();"  onChange="CalculateCardT();" size="3" maxlength="3" /&gt;&lt;/td&gt;
          &lt;td nowrap="nowrap"&gt;
            &lt;input name="strPercDeposits" type="text" required="required" id="strPercDeposits" " tabindex="7" onBlur="CalculateCardT();" onChange="CalculateCardT();" size="3" maxlength="3" /&gt;
           &lt;/td&gt;
          &lt;td nowrap="nowrap"&gt;
            &lt;input name="strPercSubscriptions" type="text" required="required" id="strPercSubscriptions" tabindex="8"  onblur="CalculateCardT();" onChange="CalculateCardT();" size="3" maxlength="3"/&gt;&lt;/td&gt;
          &lt;td nowrap="nowrap"&gt;
            &lt;input name="CardTotal" type="text" id="CardTotal" style="background-color:#CCC" size="3" maxlength="3" onKeyDown="return false;"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
  </code></pre>
  
  <p>BTW. Im a noob and useing Dreamweaver so please go easy on the code!</p>