Combat Calculator

This is simply a plug-in-your-stats and it should generate your combat level. I'm new to the wiki so not sure if Javascript works or not but no harm in trying. ^^

Combat Calculator
&lt;form&gt; &lt;input name="attackLevel" type="text" id="attackLevel" value="1" onKeyUp="combat" /&gt;attack&lt;br /&gt; &lt;input name="strLevel" type="text" id="strLevel" value="1" onKeyUp="combat" /&gt;strength&lt;br /&gt; &lt;input name="defLevel" type="text" id="defLevel" value="1" onKeyUp="combat" /&gt;defense&lt;br /&gt; &lt;input name="hpLevel" type="text" id="hpLevel" value="10" onKeyUp="combat" /&gt;hp&lt;br /&gt; &lt;input name="rangeLevel" type="text" id="rangeLevel" value="1" onKeyUp="combat" /&gt;range&lt;br /&gt; &lt;input name="magicLevel" type="text" id="magicLevel" value="1" onKeyUp="combat" /&gt;mage&lt;br /&gt; &lt;input name="prayerLevel" type="text" id="prayerLevel" value="1" onKeyUp="combat" /&gt;prayer&lt;br /&gt; &lt;input name="summoningLevel" type="text" id="summoningLevel" value="1" onKeyUp="combat" /&gt;summoning &lt;/form&gt; Your combat level is: &lt;span id="combatLevel"&gt;3.65&lt;/span&gt; &lt;script type="text/javascript"&gt; function combat{ var attack=parseInt(document.getElementById("attackLevel").value); var str=parseInt(document.getElementById("strLevel").value); var def=parseInt(document.getElementById("defLevel").value); var hp=parseInt(document.getElementById("hpLevel").value); var ranged=parseInt(document.getElementById("rangeLevel").value); var magic=parseInt(document.getElementById("magicLevel").value); var prayer=parseInt(document.getElementById("prayerLevel").value); var summoning=parseInt(document.getElementById("summoningLevel").value); var melee=(attack+str)*.325; var mage=magic*1.5*.325; var range=ranged*1.5*.325; var defHp=.25*(def+hp); var pray=0.25*(Math.floor(prayer/2)); var summ=0.25*(Math.floor(summoning/2)); if(melee&gt;range&amp;&amp;melee&gt;mage) { var combatStyle="Melee"; var combatValue=melee+defHp+pray+summ; } else if(mage&gt;range) { var combatStyle="Magic"; var combatValue=mage+defHp+pray+summ; }else { var combatStyle="Range"; var combatValue=range+defHp+pray+summ; } document.getElementById("combatLevel").innerHTML=combatValue; } &lt;/script&gt;