table, th, td {
border: 1px solid;
}
td {
text-align: center;
}
#scorecard {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#scorecard td, #customers th {
border: 1px solid #ddd;
padding: 8px;
}
#scorecard tr:nth-child(even){background-color: #f2f2f2;}
#scorecard tr:hover {background-color: #ddd;}
#scorecard th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #04AA6D;
color: white;
}
body {
background-color: lightgrey;
color: blue;
}
h1 {
background-color: black;
color: white;
}
div {
background-color: blue;
color: white;
}
Winter Scorecard 2022
Place
Competition
Date
Time
Player A Handicap
Strokes
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Hole | Length | Par | Gross | Net | Points | Pts | S.I. |
1 | 171 | 3 |
0 1 2 3 4 5 6 7 8 9 10 11 |
|
|
|
6 |
2 | 314 | 4 |
0 1 2 3 4 5 6 7 8 9 10 11 |
|
|
7 | |
3 | 261 | 4 |
0 1 2 3 4 5 6 7 8 9 10 11 |
|
|
9 | |
4 | 333 | 4 |
0 1 2 3 4 5 6 7 8 9 10 11 |
|
|
3 | |
5 | 209 | 3 |
0 1 2 3 4 5 6 7 8 9 10 11 |
|
|
5 | |
6 | 293 | 4 |
0 1 2 3 4 5 6 7 8 9 10 11 |
|
|
1 | |
7 | 338 | 4 |
0 1 2 3 4 5 6 7 8 9 10 11 |
|
|
4 | |
8 | 429 | 4 |
0 1 2 3 4 5 6 7 8 9 10 11 |
|
|
2 | |
9 | 299 | 4 |
0 1 2 3 4 5 6 7 8 9 10 11 |
|
|
8 | |
total | 2647 | 34 |
|
|
function myFunction(){
const pars = [3,4,4,4,3,4,4,4,4];
const strokeindex= [6,7,9,3,5,1,4,2,8];
//const gross = [4,4,4,5,5,5,5,5,4];
//const marker = [0,0,0,0,0,0,0,0,0];
const nets = [0,0,0,0,0,0,0,0,0];
const pts = [0,0,0,0,0,0,0,0,0];
const cum =[0,0,0,0,0,0,0,0,0];
const strokes =[0,0,0,0,0,0,0,0,0]
var points = 0;
var p1=0;
var p2=0;
var p3=0;
var p4=0;
var p5=0;
var p6=0;
var p7=0;
var p8=0;
var p9=0;
var additonalstrokes = 0;
var base = 0;
var mystrokes = document.getElementById(“strokesa”).value;
strokesa = mystrokes;
//If strokes received is greater than 9 then player will get 2 shots at some holes.
//They get extra shots where SI is equal to or lower than their strokes – 9
//They will also get a stroke at every hole in addition to the ‘extra’ shots.
base = 0;
if(mystrokes > 9)
{
base = 1;
}
//get the strokes allowed
//compare to each hole’s stroke index
//if the hole’s stroke index is less than or equal to strokes then they get a shot
//allow for this who get more than 9 shots by giving them 1 stroke per hole
//then reduce their strokes by 9 to get the holes where they get 2 shots
//Get the gross scores
//
var x1 = document.getElementById(“gross1”).value;
var g1=parseInt(x1);
var x2 = document.getElementById(“gross2”).value;
var g2=parseInt(x2);
var x3 = document.getElementById(“gross3”).value;
var g3=parseInt(x3);
var x4= document.getElementById(“gross4”).value;
var g4=parseInt(x4);
var x5= document.getElementById(“gross5”).value;
var g5=parseInt(x5);
var x6= document.getElementById(“gross6”).value;
var g6=parseInt(x6);
var x7= document.getElementById(“gross7”).value;
var g7=parseInt(x7);
var x8= document.getElementById(“gross8”).value;
var g8=parseInt(x8);
var x9= document.getElementById(“gross9”).value;
var g9=parseInt(x9);
//What to do if no score is entered
//
if(mystrokes 0){
if(strokeindex[0] 0){
if(strokeindex[1] 0){
if(strokeindex[2] 0){
if(strokeindex[3] 0){
if(strokeindex[4] 0){
if(strokeindex[5] 0){
if(strokeindex[6] 0){
if(strokeindex[7] 0){
if(strokeindex[8] 9)
{
if(g1===0){
nets[0] = 0;
}
if(g1>0){
if(strokeindex[0] 0){
if(strokeindex[1] 0){
if(strokeindex[2] 0){
if(strokeindex[3] 0){
if(strokeindex[4] 0){
if(strokeindex[5] 0){
if(strokeindex[6] 0){
if(strokeindex[7] 0){
if(strokeindex[8] <= mystrokes – 9)
{
nets[8] = x9-2;
}
else
{
nets[8]=x9-1;
}
}
}
document.getElementById("net0").innerHTML = nets[0];
if(g1===0){
document.getElementById("points1").innerHTML = 0;
}
else
{
if(nets[0] === pars[0]){
document.getElementById("points1").innerHTML = 2;
p1=2;
}
else if(nets[0] === pars[0] – 1){
document.getElementById("points1").innerHTML = 3;
p1=3;
}
else if(nets[0] === pars[0] -2){
document.getElementById("points1").innerHTML = 4;
p1=4;
}
else if(nets[0] === pars[0] – 3){
document.getElementById("points1").innerHTML = 5;
p1=5;
}
else if(nets[0] === pars[0] + 1){
document.getElementById("points1").innerHTML = 1;
p1=1;
}
else {
document.getElementById("points1").innerHTML = 0;
p1=0;
}
}
points1 = document.getElementById("points1").value;
pts[0] = p1;
points = points + points1;
document.getElementById("net1").innerHTML = nets[1];
document.getElementById("cum0").innerHTML = p1;
cum[0]=p1;
if(g2===0){
document.getElementById("points2").innerHTML = 0;
}
else
{
if(nets[1] === pars[1]){
document.getElementById("points2").innerHTML = 2;
p2=2;
}
else if(nets[1] === pars[1] – 1){
document.getElementById("points2").innerHTML = 3;
p2=3;
}
else if(nets[1] === pars[1] -2){
document.getElementById("points2").innerHTML = 4;
p2=4;
}
else if(nets[1] === pars[1] – 3){
document.getElementById("points2").innerHTML = 5;
p2=5;
}
else if(nets[1] === pars[1] – 4){
document.getElementById("points2").innerHTML = 5;
p2=5;
}
else if(nets[1] === pars[1] + 1){
document.getElementById("points2").innerHTML = 1;
p2=2;
}
else {
document.getElementById("points2").innerHTML = 0;
p2=0;
}
}
points2 = document.getElementById("points2").value;
points = points + points2;
pts[1] = p2;
document.getElementById("net2").innerHTML = nets[2];
document.getElementById("cum1").innerHTML = p1 + p2;
cum[1]=p2;
if(g3===0){
document.getElementById("points3").innerHTML = 0;
}
else
{
if(nets[2] === pars[2]){
document.getElementById("points3").innerHTML = 2;
p3=2;
}
else if(nets[2] +1 === pars[2]){
document.getElementById("points3").innerHTML = 3;
p3=3;
}
else if(nets[2] +2 === pars[2]){
document.getElementById("points3").innerHTML = 4;
p3=4;
}
else if(nets[2] +3 === pars[2]){
document.getElementById("points3").innerHTML = 5;
p3=5;
}
else if(nets[2] – 1 === pars[2]){
document.getElementById("points3").innerHTML = 1;
p3=1;
}
else {
document.getElementById("points3").innerHTML = 0;
}
}
points3 = document.getElementById("points3").value;
points = points + points3;
document.getElementById("net3").innerHTML = nets[3];
document.getElementById("cum2").innerHTML = p1 + p2 + p3;
cum[2]=p3;
pts[2] = p3;
if(g4===0){
document.getElementById("points4").innerHTML = 0;
}
else
{
if(nets[3] === pars[3]){
document.getElementById("points4").innerHTML = 2;
p4=2;
}
else if(nets[3] +1 === pars[3]){
document.getElementById("points4").innerHTML = 3;
p4=3;
}
else if(nets[3] +2 === pars[3]){
document.getElementById("points4").innerHTML = 4;
p4=4;
}
else if(nets[3] +3 === pars[3]){
document.getElementById("points4").innerHTML = 5;
p4=5;
}
else if(nets[3] + 4 === pars[3]){
document.getElementById("points4").innerHTML = 5;
p4=5;
}
else if(nets[3] – 1 === pars[3]){
document.getElementById("points4").innerHTML = 1;
p4=1;
}
else {
document.getElementById("points4").innerHTML = 0;
}
}
points4 = document.getElementById("points4").value;
points = points + points4;
document.getElementById("net4").innerHTML = nets[4];
document.getElementById("cum3").innerHTML = p1 + p2 + p3 + p4;
cum[3]=p4;
pts[3] = p4;
if(g5===0){
document.getElementById("points5").innerHTML = 0;
}
else
{
if(nets[4] === pars[4]){
document.getElementById("points5").innerHTML = 2;
p5=2;
}
else if(nets[4] +1 === pars[4]){
document.getElementById("points5").innerHTML = 3;
p5=3;
}
else if(nets[4] +2 === pars[4]){
document.getElementById("points5").innerHTML = 4;
p5=4;
}
else if(nets[4] +3 === pars[4]){
document.getElementById("points5").innerHTML = 5;
p5=5;
}
else if(nets[4] – 1 === pars[4]){
document.getElementById("points5").innerHTML = 1;
p5=1;
}
else {
document.getElementById("points5").innerHTML = 0;
}
}
points5 = document.getElementById("points5").value;
points = points + points5;
document.getElementById("net5").innerHTML = nets[5];
document.getElementById("cum4").innerHTML = p1 + p2 + p3 + p4 + p5;
cum[4]=p5;
pts[4] = p5;
if(g6===0){
document.getElementById("points6").innerHTML = 0;
}
else
{
if(nets[5] === pars[5]){
document.getElementById("points6").innerHTML = 2;
p6=2;
}
else if(nets[5] +1 === pars[5]){
document.getElementById("points6").innerHTML = 3;
p6=3;
}
else if(nets[5] +2 === pars[5]){
document.getElementById("points6").innerHTML = 4;
p6=4;
}
else if(nets[5] +3 === pars[5]){
document.getElementById("points6").innerHTML = 5;
p6=5;
}
else if(nets[5] + 4 === pars[5]){
document.getElementById("points6").innerHTML = 5;
p6=5;
}
else if(nets[5] – 1 === pars[5]){
document.getElementById("points6").innerHTML = 1;
p6=1;
}
else {
document.getElementById("points6").innerHTML = 0;
}
}
points6 = document.getElementById("points6").value;
points = points + points6;
document.getElementById("net6").innerHTML = nets[6];
document.getElementById("cum5").innerHTML = p1 + p2 + p3 + p4 + p5+p6;
cum[5]=p6;
pts[5] = p6;
if(g7===0){
document.getElementById("points7").innerHTML = 0;
}
else
{
if(nets[6] === pars[6]){
document.getElementById("points7").innerHTML = 2;
p7=2;
}
else if(nets[6] +1 === pars[6]){
document.getElementById("points7").innerHTML = 3;
p7=3;
}
else if(nets[6] +2 === pars[6]){
document.getElementById("points7").innerHTML = 4;
p7=4;
}
else if(nets[6] +3 === pars[6]){
document.getElementById("points7").innerHTML = 5;
p7=5;
}
else if(nets[6] + 4 === pars[6]){
document.getElementById("points7").innerHTML = 5;
p7=5;
}
else if(nets[6] – 1 === pars[6]){
document.getElementById("points7").innerHTML = 1;
p7=1;
}
else {
document.getElementById("points7").innerHTML = 0;
}
}
points7 = document.getElementById("points7").value;
points = points + points7;
document.getElementById("net7").innerHTML = nets[7];
document.getElementById("cum6").innerHTML = p1 + p2 + p3 + p4 + p5 + p6 + p7;
cum[6]=p7;
pts[6] = p7;
if(g8===0){
document.getElementById("points8").innerHTML = 0;
}
else
{
if(nets[7] === pars[7]){
document.getElementById("points8").innerHTML = 2;
p8=2;
}
else if(nets[7] +1 === pars[7]){
document.getElementById("points8").innerHTML = 3;
p8=3;
}
else if(nets[7] +2 === pars[7]){
document.getElementById("points8").innerHTML = 4;
p8=4;
}
else if(nets[7] +3 === pars[7]){
document.getElementById("points8").innerHTML = 5;
p8=5;
}
else if(nets[7] + 4 === pars[7]){
document.getElementById("points8").innerHTML = 5;
p8=5;
}
else if(nets[7] – 1 === pars[7]){
document.getElementById("points8").innerHTML = 1;
p8=1;
}
else {
document.getElementById("points8").innerHTML = 0;
}
}
points8 = document.getElementById("points8").value;
points = points + points8;
document.getElementById("net8").innerHTML = nets[8];
document.getElementById("cum7").innerHTML = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8;
cum[7]=p8;
pts[7] = p8;
if(g9===0){
document.getElementById("points9").innerHTML = 0;
}
else
{
if(nets[8] === pars[8]){
document.getElementById("points9").innerHTML = 2;
p9=2;
}
else if(nets[8] +1 === pars[8]){
document.getElementById("points9").innerHTML = 3;
p9=3;
}
else if(nets[8] +2 === pars[8]){
document.getElementById("points9").innerHTML = 4;
p9=4;
}
else if(nets[8] +3 === pars[8]){
document.getElementById("points9").innerHTML = 5;
p9=5;
}
else if(nets[8] + 4 === pars[8]){
document.getElementById("points9").innerHTML = 5;
p9=5;
}
else if(nets[8] – 1 === pars[8]){
document.getElementById("points9").innerHTML = 1;
p9=1;
}
else {
document.getElementById("points9").innerHTML = 0;
}
}
points9 = document.getElementById("points9").value;
points = points + points9;
document.getElementById("cum8").innerHTML = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9;
cum[8]=p9;
pts[8] = p9;
document.getElementById("totalpoints").innerHTML = p1+p2+p3+p4+p5+p6+p7+p8+p9;
//document.getElementById("grosstotal").innerHTML = x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9;
document.getElementById("grosstotal").innerHTML = g1+g2+g3+g4+g5+g6+g7+g8+g9;
document.getElementById("nettotal").innerHTML = nets[0]+nets[1]+nets[2]+nets[3]+nets[4]+nets[5]+nets[6]+nets[7]+nets[8];
}