<script>
function Calc()
{
var priceitem = Number(document.getElementById('priceitem').value)
alert (priceitem)
var priceenchant = Number(document.getElementById('priceenchant').value)
alert (priceenchant)
var basicchance = Number(document.getElementById('basicchance').value)
alert (basicchance)
var safetyenchant = Number(document.getElementById('safetyenchant').value)
alert (safetyenchant)
var levelenchant = Number(document.getElementById('levelenchant').value)
alert (levelenchant)
var sum=0
var sumpriceitem = 0
if ((levelenchant >= 0) && (levelenchant<=20))
{
if ((basicchance >=1) && (basicchance<=100))
{
if (levelenchant > safetyenchant)
{
for (i=1; levelenchat-safetyenchant; i++)
{
sum = sum + (1 - (basicchance / 100) ^ i) * priceitem
}
}
sumpriceitem = priceitem + priceenchant * levelenchant + sum
document.getElementById('summary').value = sumpriceitem
}
else
{
alert=("Chance of successful enchant incorrect. Please, re-enter chance of enchant from 1 to 100")
}
}
else
{
alert=("Level of enchant incorrect. Please, re-enter level of enchant from 0 to 20")
}
}
</script>
К сожалению, не работает.