The exercise I done for Javascript was pretty simple but I'm not sure that I've achieved the result the way I was suppose to. The question was just create an application where it gets two numbers and displays the larger number... I done this but I'm wondering what other ways is there to achieve this??
My code
HTML Code:<HTML> <HEAD> <TITLE> New Document </TITLE> <script type="text/javascript"> function calc() { var n1 = (document.form1.n1.value); var n2 = (document.form1.n2.value); if (n1 > n2) { document.write (n1); } else { document.write (n2); } } </script> </HEAD> <BODY bgcolor="ededed"> <center> <h1>Largest Number</h1> <form name="form1"> 1st <input name="n1" size="3"> 2nd <input name="n2" size="3"> <input type="button" value="Show" onClick="calc()"><p> </form> </center> </BODY> </HTML>


LinkBack URL
About LinkBacks
Reply With Quote



