<html>
<head>
<title>Greatest of three</title>
</head>
<body>
<script type="text/javascript">
var a = parseInt(prompt("Enter A"));
var b = parseInt(prompt("Enter B"));
var c = parseInt(prompt("Enter C"));
if(a == b && b == c)
document.write("A , B and C are equal! Give distinct numbers.")
else if(a == b)
document.write("A and B are equal! Give distinct numbers.");
else if(b == c)
document.write("B and C are equal! Give distinct numbers.");
else if(c == a)
document.write("A and C are equal! Give distinct numbers.");
else if(a > b) {
if(a > c)
document.write("A is the greatest");
else
document.write("B is the greatest");
}
else {
if(b > c)
document.write("B is the greatest");
else
document.write("C is the greatest");
}
</script>
</body>
</html>
当没有输入任何内容时,为什么会说“C 是最伟大的”?如果在给出 NULL 时我必须打破它,我会怎么做?