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.
This code would prompt you the value for M and C. Upon entering the values click the button to view the result.
function Button1_onclick(frm) {
var val;
val = document.forms[0].Text1.value * document.forms[0].Text2.value * document.forms[0].Text2.value
alert(val);
}
September 27th, 2007 at 5:01 pm
This code would prompt you the value for M and C. Upon entering the values click the button to view the result.
function Button1_onclick(frm) {
var val;
val = document.forms[0].Text1.value * document.forms[0].Text2.value * document.forms[0].Text2.value
alert(val);
}
//–>
Enter
M
Enter
C