raum, you should really get a blog and post all your frustrations there, it'd be great for me too look at all of them in one big heap..
y'know, that gives me an idea - I should really get myself a blog and do that too..!
better yet, I think I should make raum his left-handed scrollbar like i promised. /:D" style="vertical-align:middle" emoid=":D" border="0" alt=":D" />
Need some help with javascript
-
- Site Admin
- Posts: 2411
- Joined: Sat Nov 06, 2004 4:43 am
- Location: Sydney, Australia
- Contact:
- AYHJA
- 392
- Posts: 37990
- Joined: Fri Sep 17, 2004 2:25 pm
- Location: Washington, D.C.
- Contact:
Blogs are for T and A...WTF guys..? /laugh.gif" style="vertical-align:middle" emoid=":lol:" border="0" alt="laugh.gif" />
BBcode: | |
Hide post links |
- raum
- Posts: 3944
- Joined: Sun Jul 24, 2005 10:51 am
i fixed that last comment for ya who.am.i
you're welcome, blue-boy...
mean green
you're welcome, blue-boy...
mean green
BBcode: | |
Hide post links |
-
- Site Admin
- Posts: 2411
- Joined: Sat Nov 06, 2004 4:43 am
- Location: Sydney, Australia
- Contact:
QUOTEbetter yet, I think I should make raum his left-handed scrollbar like i promised.
maybe this screenshot will help:
maybe this screenshot will help:
BBcode: | |
Hide post links |
-
- Posts: 17
- Joined: Tue Jan 10, 2006 10:18 pm
One of the mods on my site plugged in quite a few numbers, and there seems to be an accuracy issue. I'm not sure if one part of the equation is totally correct.
If I plug in the numbers 1 att, 1 comp, 14 yards and a TD, it comes up with 160.65
158.3 is supposedly the highest number that equation can come up with.
Here's a script one of my guys found, maybe it can help.
CODE<html><header><title>Something</title></header>
<body>
<STYLE TYPE="text/css">
<!--
H1 { color: gray; font-size: 9pt; font-family: Arial; font-weight: 200 }
-->
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function calc(form,whch)
{
//data validation
var comp = parseInt(form.txtCompletions.value,10);
var atte = parseInt(form.txtAttempts.value, 10);
var yard = parseInt(form.txtYardage.value,10);
var touc = parseInt(form.txtTouchdowns.value,10);
var inte = parseInt(form.txtInterceptions.value,10);
var comp2 = form.txtCompletions.value;
var atte2 = form.txtAttempts.value;
var yard2 = form.txtYardage.value;
var touc2 = form.txtTouchdowns.value;
var inte2 = form.txtInterceptions.value;
if (atte2 == "")
{alert("Number of attempts is blank. Please correct.")
form.txtAttempts.focus()
return};
if (comp2 == "")
{alert("Number of completions is blank. Please correct.")
form.txtCompletions.focus()
return};
if (yard2 == "")
{alert ("Yardage is blank. Please correct.")
form.txtYardage.focus()
return};
if (touc2 == "")
{alert ("Number of touchdowns is blank. Please correct.")
form.txtTouchdowns.focus()
return};
if (inte2 == "")
{alert ("Number of interceptions is blank. Please correct.")
form.txtInterceptions.focus()
return};
if (( atte < 0 ) || ( comp < 0 ) || ( touc < 0) || (inte < 0) || ( atte != atte2 ) || ( comp != comp2 ) || ( yard != yard2) || (touc != touc2) || (inte != inte2))
{alert ("All entries but the entry for yardage must be non-negative integers. The entry for yardage must be an integer. Please correct.")
form.txtAttempts.focus()
return};
if (comp > atte)
{alert ("# of completions cannot be > # of attempts. Please correct.")
form.txtCompletions.focus()
return};
if ((yard != 0) && (comp == 0))
{alert ("Yardage is <> 0. Must have at least 1 completion. Please correct.")
form.txtCompletions.focus()
return};
var absYard = Math.abs(yard);
if ( absYard > (comp * 99))
{alert ("Absolute value of yardage cannot be > (# of completions * 99). Please correct.")
form.txtYardage.focus()
return};
if (touc > comp)
{alert ("# of touchdowns cannot be > # of completions. Please correct.")
form.txtTouchdowns.focus()
return};
if (( touc == comp) && ( yard < touc ))
{alert ("When # of touchdowns = # of completions, yardage must be >= # of touchdowns. Please correct.")
form.txtYardage.focus()
return};
if ((inte) > (atte - comp))
{alert ("Number of interceptions cannot be > number of incompletions. Please correct.")
form.txtInterceptions.focus()
return};
//calculation
//parts
var a = ((5*(comp/atte)) - 1.5);
var b = ((.25*(yard/atte)) - .75);
var c = (20*(touc/atte));
var d = (2.375 - (25*(inte/atte)));
//limits
if (a < 0)
{a = 0}
else if (a > 2.375)
{a = 2.375}
else
{a = a};
if (b < 0)
{b = 0}
else if(b > 2.375)
{b = 2.375}
else
{b = b};
if (c < 0)
{c = 0}
else if (c > 2.375)
{c = 2.375}
else
{c = c};
if (d < 0)
{d = 0};
//bring it together
var rate = ((a + b + c + d) * 16.666667);
//calculate percentile
var arr = new Array(68.927057412485965, 69.180581348462212, 70.092849775092077,
+ 70.109699042311931, 70.461420030929247, 71.702440919676633,
+ 71.77736512760363, 73.067317559760227, 74.133618344051044,
+ 74.472678021125404, 74.754167354412914, 75.612167928498621,
+ 75.681608163609667, 75.7117395168288, 75.779943862632493,
+ 76.326455531554515, 76.538423021813827, 77.086566728209235,
+ 77.522856684071726, 78.906201411168368, 79.523455645564439,
+ 81.923773536062114, 82.505485183141829, 82.988291575465865,
+ 83.079587846016608, 83.137666994630521, 83.222986606886636,
+ 83.780818562631723, 84.287063594157729, 85.353111556890738,
+ 88.124145704706763, 89.966520331285139);
var i = 0;
while ( rate > arr) {i += 1};
var pcttile = i / 32;
form.txtRating.value = Math.round(rate*100)/100;
form.txtPerc.value = Math.round(pcttile*10000)/100 + "%";
form.txtRating.focus();
}
function clearform(form)
{
form.txtAttempts.value = "";
form.txtCompletions.value = "";
form.txtYardage.value = "";
form.txtTouchdowns.value = "";
form.txtInterceptions.value = "";
form.txtRating.value = "";
form.txtPerc.value = "";
form.txtAttempts.focus();
}
-->
</SCRIPT>
<BASE TARGET="rtop">
</HEAD>
<BODY BGCOLOR="#800000">
<NOSCRIPT>
Your browser does not support JavaScript
</NOSCRIPT>
<DIV STYLE="left: 19; position: absolute; top: 30; width: 193; height: 303">
<FORM NAME="frmCalc">
<TABLE BORDER="1" CELLPADDING="3" STYLE="background-color: white; color: #000000; font-SIZE: 9pt; font-family: Arial; font-weight: bold">
<TR>
<TD ALIGN="center">Attempts:</TD>
<TD><INPUT SIZE="5" NAME="txtAttempts"></TD>
</TR>
<TR>
<TD ALIGN="center"><B>Completions:</B></TD>
<TD><INPUT SIZE="5" NAME="txtCompletions"></TD>
</TR>
<TR>
<TD ALIGN="center"><B>Yardage:</B></TD>
<TD><INPUT SIZE="5" NAME="txtYardage"></TD>
</TR>
<TR>
<TD ALIGN="center"><B>Touchdowns:</B></TD>
<TD><INPUT SIZE="5" NAME="txtTouchdowns"></TD>
</TR>
<TR>
<TD ALIGN="center"><B>Interceptions:</B></TD>
<TD><INPUT SIZE="5" NAME="txtInterceptions"></TD>
</TR>
<TR>
<TD BORDERCOLOR="white" ALIGN="center"><INPUT TYPE="button" VALUE="Calculate" NAME="cmdRatg" STYLE="width: 92px" onClick="calc(this.form,1)"></TD>
</TR>
<TR>
<TD ALIGN="center"><B>Rating:</B></TD>
<TD><FONT COLOR="#FFFFFF"><INPUT SIZE="5" NAME="txtRating"></FONT></TD>
</TR>
<TR>
<TD ALIGN="center"><B>Percentile:</B></TD>
<TD><FONT COLOR="#FFFFFF"><INPUT SIZE="5" NAME="txtPerc"></FONT></TD>
</TR>
<TR>
<TD BORDERCOLOR="white" ALIGN="center"><INPUT TYPE="button" VALUE="Clear Form" NAME="cmdClearForm" STYLE="WIDTH: 92px" onClick="clearform(this.form)"></TD>
</tr>
</table>
</form>
</div>
</body>
</html>
If I plug in the numbers 1 att, 1 comp, 14 yards and a TD, it comes up with 160.65
158.3 is supposedly the highest number that equation can come up with.
Here's a script one of my guys found, maybe it can help.
CODE<html><header><title>Something</title></header>
<body>
<STYLE TYPE="text/css">
<!--
H1 { color: gray; font-size: 9pt; font-family: Arial; font-weight: 200 }
-->
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function calc(form,whch)
{
//data validation
var comp = parseInt(form.txtCompletions.value,10);
var atte = parseInt(form.txtAttempts.value, 10);
var yard = parseInt(form.txtYardage.value,10);
var touc = parseInt(form.txtTouchdowns.value,10);
var inte = parseInt(form.txtInterceptions.value,10);
var comp2 = form.txtCompletions.value;
var atte2 = form.txtAttempts.value;
var yard2 = form.txtYardage.value;
var touc2 = form.txtTouchdowns.value;
var inte2 = form.txtInterceptions.value;
if (atte2 == "")
{alert("Number of attempts is blank. Please correct.")
form.txtAttempts.focus()
return};
if (comp2 == "")
{alert("Number of completions is blank. Please correct.")
form.txtCompletions.focus()
return};
if (yard2 == "")
{alert ("Yardage is blank. Please correct.")
form.txtYardage.focus()
return};
if (touc2 == "")
{alert ("Number of touchdowns is blank. Please correct.")
form.txtTouchdowns.focus()
return};
if (inte2 == "")
{alert ("Number of interceptions is blank. Please correct.")
form.txtInterceptions.focus()
return};
if (( atte < 0 ) || ( comp < 0 ) || ( touc < 0) || (inte < 0) || ( atte != atte2 ) || ( comp != comp2 ) || ( yard != yard2) || (touc != touc2) || (inte != inte2))
{alert ("All entries but the entry for yardage must be non-negative integers. The entry for yardage must be an integer. Please correct.")
form.txtAttempts.focus()
return};
if (comp > atte)
{alert ("# of completions cannot be > # of attempts. Please correct.")
form.txtCompletions.focus()
return};
if ((yard != 0) && (comp == 0))
{alert ("Yardage is <> 0. Must have at least 1 completion. Please correct.")
form.txtCompletions.focus()
return};
var absYard = Math.abs(yard);
if ( absYard > (comp * 99))
{alert ("Absolute value of yardage cannot be > (# of completions * 99). Please correct.")
form.txtYardage.focus()
return};
if (touc > comp)
{alert ("# of touchdowns cannot be > # of completions. Please correct.")
form.txtTouchdowns.focus()
return};
if (( touc == comp) && ( yard < touc ))
{alert ("When # of touchdowns = # of completions, yardage must be >= # of touchdowns. Please correct.")
form.txtYardage.focus()
return};
if ((inte) > (atte - comp))
{alert ("Number of interceptions cannot be > number of incompletions. Please correct.")
form.txtInterceptions.focus()
return};
//calculation
//parts
var a = ((5*(comp/atte)) - 1.5);
var b = ((.25*(yard/atte)) - .75);
var c = (20*(touc/atte));
var d = (2.375 - (25*(inte/atte)));
//limits
if (a < 0)
{a = 0}
else if (a > 2.375)
{a = 2.375}
else
{a = a};
if (b < 0)
{b = 0}
else if(b > 2.375)
{b = 2.375}
else
{b = b};
if (c < 0)
{c = 0}
else if (c > 2.375)
{c = 2.375}
else
{c = c};
if (d < 0)
{d = 0};
//bring it together
var rate = ((a + b + c + d) * 16.666667);
//calculate percentile
var arr = new Array(68.927057412485965, 69.180581348462212, 70.092849775092077,
+ 70.109699042311931, 70.461420030929247, 71.702440919676633,
+ 71.77736512760363, 73.067317559760227, 74.133618344051044,
+ 74.472678021125404, 74.754167354412914, 75.612167928498621,
+ 75.681608163609667, 75.7117395168288, 75.779943862632493,
+ 76.326455531554515, 76.538423021813827, 77.086566728209235,
+ 77.522856684071726, 78.906201411168368, 79.523455645564439,
+ 81.923773536062114, 82.505485183141829, 82.988291575465865,
+ 83.079587846016608, 83.137666994630521, 83.222986606886636,
+ 83.780818562631723, 84.287063594157729, 85.353111556890738,
+ 88.124145704706763, 89.966520331285139);
var i = 0;
while ( rate > arr) {i += 1};
var pcttile = i / 32;
form.txtRating.value = Math.round(rate*100)/100;
form.txtPerc.value = Math.round(pcttile*10000)/100 + "%";
form.txtRating.focus();
}
function clearform(form)
{
form.txtAttempts.value = "";
form.txtCompletions.value = "";
form.txtYardage.value = "";
form.txtTouchdowns.value = "";
form.txtInterceptions.value = "";
form.txtRating.value = "";
form.txtPerc.value = "";
form.txtAttempts.focus();
}
-->
</SCRIPT>
<BASE TARGET="rtop">
</HEAD>
<BODY BGCOLOR="#800000">
<NOSCRIPT>
Your browser does not support JavaScript
</NOSCRIPT>
<DIV STYLE="left: 19; position: absolute; top: 30; width: 193; height: 303">
<FORM NAME="frmCalc">
<TABLE BORDER="1" CELLPADDING="3" STYLE="background-color: white; color: #000000; font-SIZE: 9pt; font-family: Arial; font-weight: bold">
<TR>
<TD ALIGN="center">Attempts:</TD>
<TD><INPUT SIZE="5" NAME="txtAttempts"></TD>
</TR>
<TR>
<TD ALIGN="center"><B>Completions:</B></TD>
<TD><INPUT SIZE="5" NAME="txtCompletions"></TD>
</TR>
<TR>
<TD ALIGN="center"><B>Yardage:</B></TD>
<TD><INPUT SIZE="5" NAME="txtYardage"></TD>
</TR>
<TR>
<TD ALIGN="center"><B>Touchdowns:</B></TD>
<TD><INPUT SIZE="5" NAME="txtTouchdowns"></TD>
</TR>
<TR>
<TD ALIGN="center"><B>Interceptions:</B></TD>
<TD><INPUT SIZE="5" NAME="txtInterceptions"></TD>
</TR>
<TR>
<TD BORDERCOLOR="white" ALIGN="center"><INPUT TYPE="button" VALUE="Calculate" NAME="cmdRatg" STYLE="width: 92px" onClick="calc(this.form,1)"></TD>
</TR>
<TR>
<TD ALIGN="center"><B>Rating:</B></TD>
<TD><FONT COLOR="#FFFFFF"><INPUT SIZE="5" NAME="txtRating"></FONT></TD>
</TR>
<TR>
<TD ALIGN="center"><B>Percentile:</B></TD>
<TD><FONT COLOR="#FFFFFF"><INPUT SIZE="5" NAME="txtPerc"></FONT></TD>
</TR>
<TR>
<TD BORDERCOLOR="white" ALIGN="center"><INPUT TYPE="button" VALUE="Clear Form" NAME="cmdClearForm" STYLE="WIDTH: 92px" onClick="clearform(this.form)"></TD>
</tr>
</table>
</form>
</div>
</body>
</html>
BBcode: | |
Hide post links |
- raum
- Posts: 3944
- Joined: Sun Jul 24, 2005 10:51 am
IS HE READING IT RIGHT? I SUSPECT NOT...
I Just plugged in the following for Joe Average:
C =1
A=1
Y=14
TD=1
I=0
Joe Average's NFL QB Rate (on the bottom left) is 158.3333333333(infinite),
BUT
Joe Average's advantage OVERALL over Ben Roth is 160.6562549 (on the bottom right)
Make sure he is reading the NFL QB Rate left side of the frame, and confirm your calculations are the same as his. He might be looking at the lower right for the NFL QB Rate, when it is on the Lower LEFT. The right side is for cross-comparison for when the NFL QB Rate SEEMS even,.. but you want to see who has the upper hand on any given variable, and how much of an upperhand that gives them, though their official QB rate is the same.
FURTHERMORE, I did not CAP the main QB rate, I capped EACH VARIABLE THAT DEFINES IT (in the NFL Values)
Thus Joe Average's new stats you gave me:
NFL Values vs REAL Values
Comp% 2.375 3.5
Y.P.A. 2.375 2.75
TD% 2.375 20
Int% 2.375 2.375
And being that you said it as working fine for you, and I can't replicate this error... I would assume it is human error in reading the data presented, beign that te value is elsewhere on the screen.
SIDENOTE: Would a "REAL" QB RATE, that does not have NFL constraints be useful? One that takes the REAL Values and calculates them, to see how much of a variance there is between NFL values and actual accomplishments? i could put that in easily, now.
vertical,
raum
C =1
A=1
Y=14
TD=1
I=0
Joe Average's NFL QB Rate (on the bottom left) is 158.3333333333(infinite),
BUT
Joe Average's advantage OVERALL over Ben Roth is 160.6562549 (on the bottom right)
Make sure he is reading the NFL QB Rate left side of the frame, and confirm your calculations are the same as his. He might be looking at the lower right for the NFL QB Rate, when it is on the Lower LEFT. The right side is for cross-comparison for when the NFL QB Rate SEEMS even,.. but you want to see who has the upper hand on any given variable, and how much of an upperhand that gives them, though their official QB rate is the same.
FURTHERMORE, I did not CAP the main QB rate, I capped EACH VARIABLE THAT DEFINES IT (in the NFL Values)
Thus Joe Average's new stats you gave me:
NFL Values vs REAL Values
Comp% 2.375 3.5
Y.P.A. 2.375 2.75
TD% 2.375 20
Int% 2.375 2.375
And being that you said it as working fine for you, and I can't replicate this error... I would assume it is human error in reading the data presented, beign that te value is elsewhere on the screen.
SIDENOTE: Would a "REAL" QB RATE, that does not have NFL constraints be useful? One that takes the REAL Values and calculates them, to see how much of a variance there is between NFL values and actual accomplishments? i could put that in easily, now.
vertical,
raum
BBcode: | |
Hide post links |
-
- Posts: 17
- Joined: Tue Jan 10, 2006 10:18 pm