<form action="" method="GET"> <input type="text" name="input1" value="2"> <input type="text" name="input2" value="3"> <input type="button" name="button" value="Equals" onclick="cuentaVar(this.form)"> <span id="result" /> </form>
Y este es mi javascript:
cuentaVar = (form) -> input1 = form.input1.value input2 = form.input2.value document.getElementById("result").innerHTML = parseInt(input1, 10) + parseInt(input2, 10)