Javascript Math

Javascript Math

<html>
<head>
<title>working with radio buttons</title>
<script>
function calculate(form)
{
if(form.elements[1].checked)
{
form.result.value = form.n1.value*2;
}
else
{

form.result.value=form.n1.value*form.n1.value;
}
}
</script>
</head>
<body>
<form>
<input type=”text” value=”0″ Name=”n1″ placeholder=”Enter number”><br>
<input type=”Radio” value=”Twice” onClick=”calculate(this.form);” name=”ss”>Double<br>
<input type=”Radio” value=”square” onClick=”calculate(this.form);” name=”ss”>Square<br>
<input type=”text” name=”result” onFocus=”this.blur();” value=”0″>
<input type=”Reset” value=”Reset”>
</form>
</body>
</html>

Result of  Javascript Math :-

 Javascript Math




Follow Us

Contact Us

tutorialworldin@yahoo.com

Back to Top