html - Javascript not alerting input value -
html - Javascript not alerting input value -
the code below isn't working expected. have excluded rest of tags. whenever execute html, alert alerts nil @ all. has encountered problem before?
<p><input type="text" id = "earth"> come in weight on earth.<br><br></p> <script type="text/javascript"> function calculate() { var weight = input.earth.value; window.alert(weight); } </script>
you're not getting element correctly - input.earth means nothing. should utilize getelementbyid():
var weight = document.getelementbyid('earth').value; javascript html web
Comments
Post a Comment