You will need to set up hidden fields to old the values.
If you have a submit/save button place the script behind the click event of that button.
If you want to calculate as the user selects from the drop down then put the script on the calculate event of the hidden field.
The script is long winded and someone with a bit more javascript expertiese may be able to provide a simplier version.
var total1 = 0;
var total2 = 0;
var total3 = 0;
var total4 = 0;
if (dropdown1.rawValue == "1")
{
total1 = total1 + 1;
}
else if (dropdown1.rawValue == "2")
{
total2 = total2 + 1;
}
else if (dropdown1.rawValue == "3")
{
total3 = total3 + 1;
}
else
{
total4 = total4 + 1;
}
//"the script above shoudl be repated for all dropdown lists"
hiddenfieldTotal1.rawValue = total1;
hiddenfieldTotal2.rawValue = total2;
hiddenfieldTotal3.rawValue = total3;
hiddenfieldTotal4.rawValue = total4.