User:GorillaMan/sandbox

function doExperience (Level) { if (isNaN(Level)) return("???"); if (Level < 0) return("???"); else if (Level == 0) return(0); else if (Level == 1) return(27 ); else if (Level == 2) return( 7 ); else if (Level == 3) return( 14 );

else if (Level == 4) return( 30 );

else if (Level == 5) return( 50 );

else if (Level == 6) return( 220 );

else if (Level == 7) return( 370 );

else if (Level == 8) return( 490 );

else if (Level == 9) return( 790 );

else if (Level == 10) return( 960 );

else if (Level == 11) return( 1180 );

else if (Level == 12) return( 1550 );

else if (Level == 13) return( 1790 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2,880 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

else if (Level == 14) return( 2270 );

return("???"); }

function calcExperience (index) { var Level = parseInt(document.getElementById("lev_input_" + index).value); var result = doExperience(Level); if (result != 1) document.getElementById("ex_result_" + index).innerHTML = " = " + result + " Experience"; else document.getElementById("ex_result_" + index).innerHTML = " = " + result + " Experience"; return false; } function createExperience { var paras = document.getElementsByTagName("p"); var offset = 0; for (var index = 0; index < paras.length; index++) { if (hasClassTest(paras[index], "calc-ex")) { var form = document.createElement("form"); var input1 = document.createElement("input"); var input2 = document.createElement("input"); var span = document.createElement("span"); form.setAttribute("onSubmit", "return calcExperience(" + offset + ");"); input1.setAttribute("size", "10"); input1.setAttribute("value", "0"); input1.setAttribute("id", "lev_input_" + offset); input2.setAttribute("type", "button"); input2.setAttribute("value", "Calculate Experience"); input2.setAttribute("onclick", "javascript:calcExperience(" + offset + ");"); span.setAttribute("id", "ex_result_" + offset); span.innerHTML = " = 0 Experience"; form.appendChild(document.createTextNode("Level: ")); form.appendChild(input1); form.appendChild(input2); form.appendChild(span); paras[index].appendChild(form); offset++; }  } } addOnloadHook(createExperience);