text: // when the compute interest button is clicked the user's inputs are returned in the result span, with the values highlighted.
  function compute()
  {
      var principal = document.getElementById("principal").value;
      var rate = document.getElementById("rate").value;
      var years = document.getElementById("years").value;
      var interest = principal * years * rate /100;
      var year = new Date().getFullYear()+parseInt(years);
  
      result = document.getElementById("result")
      result.innerHTML="If you deposit \<mark class=\"highlight\"\>$"+principal+"\</mark\>"+",\<br\>at an interest rate of \<mark class=\"highlight\"\>"+rate+"%\</mark\>\<br\>You will receive an amount of \<mark class=\"highlight\"\>$"+interest+"\<\/mark\>,\<br\>in the year \<mark class=\"highlight\"\>"+year+"\<\/mark\>.\<br\>";
  }
  // when the rate is changed the displayed rate is updated.
  function updateRate() 
  {
      var rateval = document.getElementById("rate").value;
      document.getElementById("rate_val").innerText=rateval+"%";
  }
  
  // when the reset form btn is clicked the rate displayed is reset to default.
  function resetRate() 
  {
      var ratedefault = document.getElementById("rate").value;
      document.getElementById("rate_val").innerText="10.25%";
  }
  
  
  // when the form is submited we check the user's input for the principal
  function checkdata()
  {
      var principalUnchecked = document.getElementById("principal");
  
      // checking if principal was left blank
      if (principalUnchecked.value == "") {
          alert("Principal amount must be entered.");
          principalUnchecked.focus();
          return false;
      }
      // checking if principal was a negative number
      if (principalUnchecked.value < 0) {
          alert("Principal amount must not be a negative number.");
          principalUnchecked.focus();
          return false;
      }
      // checking if principal is equal to zero
      if(principalUnchecked.value == 0) {
          alert("Principal amount must not be 0.");
          principalUnchecked.focus();
          return false;
      }
      return false;
      
  }