else if(x<y){return y;}和else {return "两数相等";}顺序不一样导致结果不一样
<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>函数</title>
<script type="text/javascript">
/*function max1(x,y)
{
if(x>y){return x;}
else if(x<y){return y;}
else {return "两数相等";}
}*/
function max1(x,y)
{
if(x>y){return x;}
else if(x=y){return "两数相等";}
else {return y;}
}
document.write(" 5 和 4 的较大值是:"+max1(5,4)+"<br>");
document.write(" 6 和 7 的较大值是:" +max1(6,7)+"<br>");
document.write(" 8 和 8 的较大值是:" +max1(8,8));
</script>
</head>
<body>
</body>
</html>