Page 1 of 3

Need some help with javascript

Posted: Tue Jan 24, 2006 10:13 am
by gtsch
I'm been trying to design something for my website where you can put in a QB's stats, and then get the QB passer rating. I've tried a few times and failed badly do to my inexperience.

This is the formula, it's a little tricky.

C=completions
A=attempts
Y=yards
T=Touchdowns
I=interceptions

Rating =100/6 * [ (A/C-0.3)*5 + (Y/A - 3)/4 + (T/A) * 20 + (2.375 - 25*I/A) ]


The only catch is that all four of those parts have to be between 0 and 2.375
I'd appreciate any help that anyone can offer. Thanks.

Posted: Tue Jan 24, 2006 10:46 am
by AYHJA
As I mentioned, we can get raum to put this to Excel, and maybe me or WAI could put it to html or Java for you...Is this module to be embedded in a page, or shown as a pop-up..? Or maybe a linky link to the site so we can have a look..?

Posted: Tue Jan 24, 2006 10:50 am
by gtsch
Here's my site

http://www.ninercaphell.com

This is still in it's early stages, as I am learning on the job as far as how to build a site.

I was thinking like a pop up window if that's possible.

Posted: Tue Jan 24, 2006 10:57 am
by AYHJA
I'm thinking we can have you al fixed up by the end of this day...Assuming raum isn't saving the world via his global power ties, he should be able to hook this up...

That's a great looking site, heh...Didn't know you were a 49'ers fan...We're fighting now about who they're going to draft in teh sports section...

Posted: Tue Jan 24, 2006 1:30 pm
by raum
i can do this in excel blindfolded on my lunch break, but it seems to me that php would be far better for online apps...

but if you want to embed the excel object, i can do it at work. otherwise, i can't help right now.

personally, i would not make it a popup... i'd make it a embedded frame object, in your html table, or a roll-down flash-app, and have a "Passer Calc" (or whatever, and when you click it, it rolls down from the main menu tab.)

i hate pop-ups, so i am a bit biased.

lemme get this excel to you today, then you can just embed it, from your hosting package. good tuts on that everywhere.

Ch

Posted: Tue Jan 24, 2006 2:15 pm
by AYHJA
Man is golden w/an Excel program, I swears...

Posted: Tue Jan 24, 2006 3:20 pm
by raum
ok, I got something in dev on this. the formula works fine, and I am just trying to build in integrity checks.

can one of you foozball fans please confirm ALL FOUR of these values must be between 0 and 2.375?

I was also thinking if you want room for more than one qb, and a cross comparison of stats? and if so, how many qb at once?

live to serve,
Ch

Posted: Tue Jan 24, 2006 3:28 pm
by deepdiver32073
As a fan, I'd certainly want to be able to compare the stats of 2 or more QBs. As to the formula, I can't help you there. I've never known how they figured the QB rating. The formula looks interesting, but as far as the limitation to 2.375 and under... don't know.

Posted: Tue Jan 24, 2006 3:56 pm
by AYHJA
Here are the stats of great USC Trojan QB Matt Leinhart... /:D" style="vertical-align:middle" emoid=":D" border="0" alt=":D" />

Completions - Attempts - Yards - Comp. % - YPA - Long - Touchdowns - Interceptions

283 431 3815 65.7 8.85 67 28 8

And next years Heisman Trophy Winner, Brady Quinn

292 450 3919 64.9 8.71 80 32 7

Now...Lets see if your new toy can calculate the correct ratings raumie...

Posted: Tue Jan 24, 2006 3:59 pm
by raum
alternately, you could just use this one:

http://www.primecomputing.com/

UPDATE: this sucks - the completion % is messed up.