<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function ro_div_b(form) {
ro=parseFloat(form.ro.value)
b=parseFloat(form.b.value)
c=ro/b
form.ans.value = c
}
function alfa(form) {
form.ans3.value = a;error
}
var a = 10;
var error = "error";
if (c<5 && c>3)
{
document.write(a);
}
else {
document.write(error);
}
</script>
</head>
<body>
<CENTER>
<FORM name="formx">
<table width="93" border="1">
<tr>
<td width="30">ρ=</td>
<td width="154"><input type=text size=4 value="" name="ro"></td>
</tr>
<tr>
<td>b=</td>
<td><input type=text size=4 value="" name="b"></td>
</tr>
<tr>
<td>ρ/b=</td>
<td><input type "number" value=0 name="ans" size=9></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="button" value=" ok " onClick="ro_div_b(this.form);alfa(this.form)">
</div></td>
</tr>
<tr>
<td colspan="2">
</div>
<div align="center">
<input type="type" "number" value="" name="ans3" size="9" />
</div>
</td>
</tr>
</table>
</FORM>
</CENTER>
</body>
</html>
problem is in function alfa…i am aware that there is no way this is going to work, but i need a solution
so if answer is between 3 and 5 it writes 10 and if it not it writes error
pls help