Jump to content

nikki-wt

Members
  • Posts

    1
  • Joined

  • Last visited

nikki-wt's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I'm using this script to calculate the values of a number of fields, and then display the total on the next page. Since the values are numerical, the corresponding table fields are set to 'Number' and in this script I am also converting the variable to a number. Does anybody have a clue why it only works in Internet Explorer, but not Firefox or Chrome? I'm really scratching my head... Here's the code: <SCRIPT LANGUAGE="JavaScript"> function calculate() { var v_q1a = document.getElementById('InsertRecordQ1a'); var q1a = parseInt( v_q1a.value); var v_q1b = document.getElementById('InsertRecordQ1b'); var q1b = parseInt( v_q1b.value); var v_q2a = document.getElementById('InsertRecordQ2a'); var q2a = parseInt( v_q2a.value); var v_q2b = document.getElementById('InsertRecordQ2b'); var q2b = parseInt( v_q2b.value); var v_q3 = document.getElementById('InsertRecordQ3'); var q3 = parseInt( v_q3.value); var v_q4a = document.getElementById('InsertRecordQ4a'); var q4a = parseInt( v_q4a.value); var v_q4b = document.getElementById('InsertRecordQ4b'); var q4b = parseInt( v_q4b.value); var v_q4c = document.getElementById('InsertRecordQ4c'); var q4c = parseInt( v_q4c.value); var v_q5 = document.getElementById('InsertRecordQ5'); var q5 = parseInt( v_q5.value); var total = (q1a + q1b + q2a + q2b + q3 + q4a + q4b + q4c + q5); document.getElementById('InsertRecordtotal').value = Math.round(total); } document.getElementById("caspioform").onsubmit=calculate; </script>
×
×
  • Create New...