Question: 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.

Answer: This code would prompt you the value for M and C. Upon entering the values click the button to view the result.\n\n\n\n<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\n<html>\n<head>\n<title></title>\n<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">\n<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">\n<script id="clientEventHandlersJS" language="javascript">\n\nfunction Button1_onclick(frm) {\nvar val;\nval = document.forms[0].Text1.value * document.forms[0].Text2.value * document.forms[0].Text2.value\nalert(val);\n}\n\n//-->\n</script>\n</head>\n<body>\n<form>\n<DIV title="Enter M" style="DISPLAY: inline; WIDTH: 70px; HEIGHT: 15px" ms_positioning="FlowLayout">Enter \nM</DIV>\n<INPUT id="Text1" type="text" name="Text1"><br>\n<DIV title="Enter M" style="DISPLAY: inline; WIDTH: 70px; HEIGHT: 15px" ms_positioning="FlowLayout">Enter \nC</DIV>\n<INPUT id="Text2" type="text" name="Text2" language="javascript" onclick="return Text2_onclick()">\n<INPUT id="Button1" type="button" value="E = Mc2" name="Button1" language="javascript"\nonclick="return Button1_onclick(this)"><br>\n \n</form>\n</body>\n</html>
This question from the Yahoo Q&A forum is categorized in the topic: Entertainment & Music