Q:

Javascript setting Maximum & Minimum Answers

I need to ensure the minimum answer is 5 and the maximum can be no larger than 25. The code I use is:
function temp(form)
{
    var i = parseFloat(form.Inc.value, 10);
    var c = 0;
    c = 25 - ((300 - i) * 8.0 / 100);
   form.Fee.value = c.toFixed(2);

   function decrease(form)
   {
        if (c > 25) 
        {
           c--;
           document.getElementById('Fee').innerHTML = 25;
        }
   }

   function increase(form)
   {
       if (c < 5) 
       {
           c++;
           document.getElementById('Fee').innerHTML = 5;
       }
   }
}

However the answer box in the form doesn't recognise the minimum and maximum figures.

A:

form.Fee.value implies that your form has an element named "Fee".
The "name" attribute is different from the "id" attribute, and as you've likely not given your form elements 'id's, document.getElementById() is presumably returning null.
Consider using document.getElementsByName or using form.Fee.
Additionally, the decrease() and increase() methods aren't being invoked.
I think you're looking for code like this:
 function temp(form)
 {
    var i = parseFloat(form.Inc.value, 10);
    var c = 0;
    c = 25 - ((300 - i) * 8.0 / 100);

    // Alternatively use Math.min and Math.max
    if ( c > 25 ) c = 25; 
    if ( c < 5 ) c = 5;

    form.Fee.value = c.toFixed(2);
 }

Additional notes; var c can be initialized with the expression in the line right below it; the initialization to 0 is unnecessary.  

