<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1250" http-equiv=Content-Type>
<META content="MSHTML 5.00.2919.6307" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#c0c0c0>
<DIV>Hello,<BR>I'm new to this group & very new to JavaScript.<BR><BR>I was
hoping someone might be able to help me. I'm having one hell of time trying to
get this to work. What I've done is combine 3 different scripts into 1. It's a
ratings calculator. I have it mostly working except that it is not showing me my
point gain/loss in IE (just NaN and showing the wrong value in Nets!) & it's
also not showing the new ratings at all in Netscape (just NaN). You can see it
here <A
href="http://www.mtgontario.com/calculator1.php">http://www.mtgontario.com/calculator1.php</A>
or view the code below.<BR><BR>I'm not sure how to get this to work. I'm not
getting error messages so I have no idea even where the problem is. Usually I
just do the javascript: thing in Nets or look at the error messages in IE to try
& find the problem & tinker with it until I get it right! I'd appreciate
any help I could get with this.<BR><BR>Thanks,<BR>Andi<BR><BR>Ps, if you want to
know some correct numbers for this the results would be:<BR><BR>You:
1655<BR>Them: 1866<BR>Loss<BR>Win %: 23<BR>Point g/l: -4<BR>Your New:
1651<BR>Their New: 1870<BR><BR><script language="JavaScript"
type="text/javascript"><BR><!--<BR>var rating0;<BR>var opponent0;<BR>var
my_result;<BR>var my_win_exp;<BR>var my_new_rating;<BR>var my_diff;<BR>var
k1=20;</DIV>
<DIV> </DIV>
<DIV>function calc(form)<BR> {</DIV>
<DIV> </DIV>
<DIV>for (Count = 0; Count < 3; Count++)<BR> {<BR> if
(form.wld[Count].checked)<BR> break;<BR> }</DIV>
<DIV> </DIV>
<DIV>if (Count==0) {my_result=1;} else<BR>if (Count==1) {result=0;}
else<BR>{my_result=0.5;}</DIV>
<DIV> </DIV>
<DIV>my_win_exp = 1 / (Math.pow(10,((form.opponent0.value -
form.rating0.value) / 400)) +1);<BR>my_diff = (k1 * (my_result -
my_win_exp));</DIV>
<DIV> </DIV>
<DIV>form.fwinexp.value=Math.round(100*my_win_exp);<BR>form.fmydiff.value=(Math.round(my_diff
* 100)) / 100;</DIV>
<DIV> </DIV>
<DIV>if (form.wld[0].checked) scoringpoints = 1;<BR>if (form.wld[1].checked)
scoringpoints = 0;<BR>if (form.wld[2].checked) scoringpoints =
0.5;<BR>winprobability = 1 / (Math.pow(10,((parseInt(form.opponent0.value) -
parseInt(form.rating0.value)) / 400)) +
1)<BR>form.rating1.value=Math.round(parseInt(form.rating0.value) +
(parseInt(form.Kvalue.value) * (scoringpoints -
winprobability)))<BR>form.rating2.value=Math.round(parseInt(form.opponent0.value)
+ (parseInt(form.Kvalue.value) * (winprobability - scoringpoints)))</DIV>
<DIV> </DIV>
<DIV>}</DIV>
<DIV> </DIV>
<DIV>function set_rating0(rating)<BR>{<BR> rating0 =
rating.value;<BR>}</DIV>
<DIV> </DIV>
<DIV>function set_opponent0(rating)<BR>{<BR> opponent0 =
rating.value;<BR>}</DIV>
<DIV> </DIV>
<DIV>function set_kvalue()<BR>{<BR> var i =
document.calcform.Kvalue.selectedIndex;<BR> k1 =
document.calcform.Kvalue.options[i].value;<BR>}</DIV>
<DIV> </DIV>
<DIV>// --><BR></script></DIV>
<DIV> </DIV>
<DIV><form method="POST" name="calcform"><BR><div
align="center"><center><BR><table border="1" bgcolor="#000000"
bordercolor="#000000" bordercolordark="#000000"
bordercolorlight="#000000"><BR><tr><BR><td colspan="2"
bgcolor="#CCCCCC"><BR><font color="#000000" size="2"
face="Verdana"><strong>- Unofficial DCI Ratings Calculator
-</strong></font>
<BR></td><BR></tr><BR><tr><BR><td
bgcolor="#B1B3BC"><BR><font color="#000000" size="2"
face="Verdana"><strong>&nbsp;Your Rating:
</strong></font><br><BR></td><BR><td align="center"
bgcolor="#666977"><INPUT TYPE="text" NAME="rating0" SIZE="6"
style="background:#B1B3BC" style="border-color:#C0C0C0" style="color:#000000"
style="font-family:verdana"
ONCHANGE="set_rating0(this)"><br><BR></td><BR></tr><BR><tr><BR><td
bgcolor="#B1B3BC"><BR><font color="#000000" size="2"
face="Verdana"><strong>&nbsp;Opponent's Rating:
</strong></font><br><BR></td><BR><td align="center"
bgcolor="#666977"><BR><INPUT TYPE="text" NAME="opponent0" SIZE="6"
style="background:#B1B3BC" style="border-color:#C0C0C0" style="color:#000000"
style="font-family:verdana"
ONCHANGE="set_opponent0(this)"><br><BR></td><BR></tr><BR><tr><BR><td
bgcolor="#B1B3BC"><BR><font color="#000000" size="2"
face="Verdana"><strong>&nbsp;Match Result:
</strong></font><br><BR></td><BR><td
bgcolor="#666977"><BR><INPUT TYPE="radio" NAME="wld" VALUE="win"
CHECKED> <font color="#FFFFFF" size="2"
face="Verdana">Win</font><br><BR><INPUT NAME="wld"
TYPE="radio" VALUE="lose"> <font color="#FFFFFF" size="2"
face="Verdana">Loss</font><br><BR><INPUT NAME="wld"
TYPE="radio" VALUE="draw"> <font color="#FFFFFF" size="2"
face="Verdana">Draw</font><br><BR></td><BR></tr><BR><tr><BR><td
bgcolor="#B1B3BC"><BR><font color="#000000" size="2"
face="Verdana"><strong>&nbsp;K-value:
</strong></font><br><BR></td><BR><td
bgcolor="#666977"><BR><select name="Kvalue" size="1"
style="background:#B1B3BC" style="border-color:#C0C0C0" style="color:#000000"
style="font-family:verdana" onchange="set_kvalue();"><BR><option
value="8"> 8 </option><BR><option selected value="16"> 16
</option><BR><option value="20"> 20 </option><BR><option
value="24"> 24 </option><BR><option value="28"> 28
</option><BR><option value="32"> 32 </option><BR><option
value="40"> 40 </option><BR><option value="48"> 48
</option><BR></select><BR></td><BR></tr><BR><tr><BR><td
align="center" bgcolor="#FFFFFF"><BR><p align="center"><input
type="button" style="BACKGROUND: #000000; BORDER-BOTTOM: #B1B3BC 2px solid;
BORDER-LEFT: #B1B3BC 2px solid; BORDER-RIGHT: #B1B3BC 2px solid; BORDER-TOP:
#B1B3BC 2px solid; COLOR: #B1B3BC" style="font-family:verdana"
value="Calculate" <BR>onclick="calc(this.form)">
</p><BR></td><BR><td align="center"
bgcolor="#FFFFFF"><BR><p align="center"><input type="reset"
style="BACKGROUND: #000000; BORDER-BOTTOM: #B1B3BC 2px solid; BORDER-LEFT:
#B1B3BC 2px solid; BORDER-RIGHT: #B1B3BC 2px solid; BORDER-TOP: #B1B3BC 2px
solid; COLOR: #B1B3BC" style="font-family:verdana" value="Reset">
</p><BR></td><BR></tr><BR><tr><BR><td
bgcolor="#B1B3BC"><BR><font color="#000000" size="2"
face="Verdana"><strong>&nbsp;Win Expectancy %:
</strong></font><br><BR></td><BR><td align="center"
bgcolor="#666977"><input type="text" size="6"
style="background:#B1B3BC" style="border-color:#C0C0C0" style="color:#000000"
style="font-family:verdana"
name="fwinexp"><br><BR></td><BR></tr><BR><tr><BR><td
bgcolor="#B1B3BC"><BR><font color="#000000" size="2"
face="Verdana"><strong>&nbsp;Point Gain/Loss:
</strong></font><br><BR></td><BR><td align="center"
bgcolor="#666977"><BR><input type="text" size="6"
style="background:#B1B3BC" style="border-color:#C0C0C0" style="color:#000000"
style="font-family:verdana"
name="fmydiff"><br><BR></td><BR></tr><BR><tr><BR><td
bgcolor="#B1B3BC"><BR><font color="#000000" size="2"
face="Verdana"><strong>&nbsp;Your New Rating:
</strong></font><br><BR></td><BR><td align="center"
bgcolor="#666977"><BR><INPUT TYPE="text" NAME="rating1" size="6"
style="background:#B1B3BC" style="border-color:#C0C0C0" style="color:#000000"
style="font-family:verdana"><br><BR></td><BR></tr><BR><tr><BR><td
bgcolor="#B1B3BC"><BR><font color="#000000" size="2"
face="Verdana"><strong>&nbsp;Their New Rating:
</strong></font><br><BR></td><BR><td align="center"
bgcolor="#666977"><BR><INPUT TYPE="text" NAME="rating2" size="6"
style="background:#B1B3BC" style="border-color:#C0C0C0" style="color:#000000"
style="font-family:verdana"><br><BR></td><BR></tr><BR><tr><BR><td
colspan="2" bgcolor="#C0C0C0"><BR><center><BR><font color="#000000"
size="2" face="Verdana"><b>Author: <a <A
href='mailto:href="mailto:andi@mtgontario.com"'>href="mailto:andi@mtgontario.com"</A>>Andi
@ M:tG
Ontario.com</a></b></font><BR></center><BR></td><BR></tr><BR></table><BR></center></div></DIV>
<DIV></form><BR></DIV></BODY></HTML>