Background Information This is the bottom half of an if statement. I am trying to determine what the number of points that the wrestler won by and award him the proper point for the match and seeding.
Essentially there are three categories: Tech Fall, a Major and win by decision.
A decision is any win with 7 or less points between opponents.
A major is a win with between 8 and 14 points awarded to the winner
A tech fall happens when the wrestler wins with over 15 points in his favor.
Each level awards more points.
The problem that I am having is asking the switch to determine how many points.
I have assigned the point difference to the variable 'scorediff' and in the alert box it is telling me that the math part of this operation is working.
THE ISSUE: Nothing triggers except the default
I tried this also:
case scorediff < 7:
its a decision - do this code;
case scorediff < 14:
its a major - do this code;
default
its a tech fall - do this code;
Here is an example of my current code, please point out my mistake as I just can figure this one out so far.
Thanks!
Essentially there are three categories: Tech Fall, a Major and win by decision.
A decision is any win with 7 or less points between opponents.
A major is a win with between 8 and 14 points awarded to the winner
A tech fall happens when the wrestler wins with over 15 points in his favor.
Each level awards more points.
The problem that I am having is asking the switch to determine how many points.
I have assigned the point difference to the variable 'scorediff' and in the alert box it is telling me that the math part of this operation is working.
THE ISSUE: Nothing triggers except the default
I tried this also:
case scorediff < 7:
its a decision - do this code;
case scorediff < 14:
its a major - do this code;
default
its a tech fall - do this code;
Here is an example of my current code, please point out my mistake as I just can figure this one out so far.
Thanks!
Code:
var scoredif = (vismatchscore-homematchscore)
alert ("The visitor won")
alert (scoredif)
switch (scoredif)
{
case scoredif >= 1 && scoredif <=7:
alert ("Vis win by decision");
break;
case scoredif >= 8 && scoredif <=14:
alert ("Vis Win by Major");
break;
default:
alert ("Vis Win Tech Fall");
//var userinput = prompt("Enter the time of the match in this format: 0000 (the program will insert the colon)");
//window.document.match_information.txtMatchTime.value = userinput.slice(0,2) + ":" + userinput.slice(2,4);
//window.document.match_information.txtHomeSeed.value = 1;
//window.document.match_information.txtVisitingSeed.value = 6;
//window.document.match_information.txtHomeMatch.value = 0;
//window.document.match_information.txtVisitingMatch.value = 5;
//window.document.match_information.txtHomeBoutOutcome.value = "Loss by Tech Fall";
//window.document.match_information.txtVisitingBoutOutcome.value = "Win by Tech Fall";
//window.document.match_information.cmdSubmit.focus()
break;
} //end of switch