html - javascript text doesn't display -
i making simple program "find largest number". problem is, can't display output of answer. there wrong on code? thanks
<html> <head> <title> short lab activity 1 </title> <style> #compute{ text-align: center; } </style> </head> <body> <div id="compute"> input 1st number: <input type="integer" id="num1" size="20"/> </br></br> input 2nd number: <input type="integer" id="num2" size="20"/> </br></br> answer: <input type="integer" id="answer" size="20"/> </div> <center><input type="button" id="find" value="find largest" onclick()="find()"/></center> <script type="text/javascript"> function find() { var numb1 = document.getelementbyid("num1").value; var numb2 = document.getelementbyid("num2").value; var answer; if(numb1 > numb2) document.getelementbyid("answer").value = numb1; if(numb2 > numb1) document.getelementbyid("answer").value = numb2; } </script> </body> </html>
change onclick()="find()"
onclick="find()"
Comments
Post a Comment