Click to See Complete Forum and Search --> : modify source code to user answer


toppie
08-21-2003, 02:08 PM
function doMath() {
var one = eval(document.theForm.elements[0].value)
var two = eval(document.theForm.elements[1].value)
var prod = one * two
alert("The product of " + one + " and " +
two + " is " + prod + ".")
}
</SCRIPT>
<BODY>

<CENTER>
<FORM NAME="theForm">
Multiply
<INPUT TYPE="text">
By
<INPUT TYPE="text">
<INPUT TYPE="button" VALUE="Show result" onClick="doMath()">
</FORM>
</CENTER>

diamonds
08-21-2003, 02:14 PM
No one's going to awnser if you don't have a question.
What is your question?

If you want to write HTML to a page, use document.write() You can edit the value of a textbox by using document.FORM.ELEMENT.value = "New Value"; :

<form name="thisform">
<input name='input' value="value"><input type=button value="click me!" onclick="document.thisform.input.value='new value';">
</form>

toppie
08-21-2003, 02:29 PM
hello