I've made this simple script to automatically add up set numbers in hidden text boxes, but it doesn't work, and I don't know why. Could someone help me with this matter?

The script follows...

<script language="JavaScript">

function total(form)
{ form.total.value = ((form.text.value*1)+(form.button.value*1)+(form.pro.value*1)+(form.real.value*1)+(form.misc.value*1)) }

document.write("<form>");
document.write("<input type=hidden name=text value=32>");
document.write("<input type=hidden name=button value=10>");
document.write("<input type=hidden name=pro value=5>");
document.write("<input type=hidden name=real value=6>");
document.write("<input type=hidden name=misc value=4>");
document.write("<input type=button value='=' onClick=total(this.form)><input type=text name=total>");
document.write("</form>");

</script>

- Will