<html>
<body>
<form name="form1">
<input type="text" name="txt1" size="3" onblur="caL()">
<input type="text" name="txt2" size="3" onblur="caL()">
<script language="javascript">
function caL(){
if(document.form1.txt1.value<=0) alert("enter A");
else if(document.form1.txt2.value<=0) alert("enter B");
else
{
caLz();
}
}
function caLz(){
n= document.form1.txt1.value;
m=document.form1.txt2.value;
alert(10/(4*n*n*m*m));
}
</script>
</form>
</body>
</html>
โค้ดเฉลยให้เพื่อนดู
ทำได้หลังส่งคำตอบไปแล้ว กรี๊ด