How do you made an integer input field in html?
I want to be able to make a simple form for calculating, a formula, such as E = mc^2. How would I make the inputs, and how would I display the calculated values? The best answer will include the html necessary to get the user values, compute them, and display them on the page.
Public Comments
- This code would prompt you the value for M and C. Upon entering the values click the button to view the result. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> <script id="clientEventHandlersJS" language="javascript"> function Button1_onclick(frm) { var val; val = document.forms[0].Text1.value * document.forms[0].Text2.value * document.forms[0].Text2.value alert(val); } //--> </script> </head> <body> <form> <DIV title="Enter M" style="DISPLAY: inline; WIDTH: 70px; HEIGHT: 15px" ms_positioning="FlowLayout">Enter M</DIV> <INPUT id="Text1" type="text" name="Text1"><br> <DIV title="Enter M" style="DISPLAY: inline; WIDTH: 70px; HEIGHT: 15px" ms_positioning="FlowLayout">Enter C</DIV> <INPUT id="Text2" type="text" name="Text2" language="javascript" onclick="return Text2_onclick()"> <INPUT id="Button1" type="button" value="E = Mc2" name="Button1" language="javascript" onclick="return Button1_onclick(this)"><br> </form> </body> </html>
Powered by Yahoo! Answers