1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
|
var red=0, purple=0, blue=0, green=0, pink=0, orange=0, black=0, yellow=0, brown=0, grey=0;
var ten=0, twenty=0, thirty=0, forty=0, fifty=0, sixty=0, seventy=0, eighty=0;
var colors = new Array(red, purple, blue, green, pink, orange, black, yellow, brown, grey);
var colorNames = new Array("red","purple","blue","green","pink","orange","black","yellow","brown","grey");
var groups = new Array(ten, twenty, thirty, forty, fifty, sixty, seventy, eighty);
var valid = false;
var alertStr = '';
function DisplayFormValues() {
var elem = document.getElementById('colors').elements;
for(var i = 0; i < elem.length; i++) {
if (elem[i].type == "radio") {
if (elem[i].checked) {
var radioValue = elem[i].value
if (radioValue.indexOf('~') != -1) {
var valueArray = radioValue.split('~');
for(var j = 0; j < valueArray.length; j++) {
colors[parseInt(valueArray[j])] ++;
}
} else {
colors[parseInt(radioValue)] ++;
}
}
}
}
DisplayResult();
}
function DisplayResult() {
var highest = 0;
var highestName = '';
for (x = 0; x < colors.length; x++) {
if (colors[x] > highest) {
highest = colors[x];
highestName = colorNames[x];
}
}
window.location.href = "./" + "Color/" + highestName + ".html";
}
|