問題出在哪里??求大神解惑??!
<!DOCTYPE? HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>函數</title>
<script type="text/javascript">
function max(x,y){//定義函數
if(x>y){
document.write(x);
}
else if(x<y){
document.write(y);
}
else{
document.write("兩個值相等!");
}
}
//函數體,判斷兩個整數比較的三種情況
//調用函數,實現下面兩組數中,返回較大值。
? document.write(" 5 和 4 的較大值是:"+max(5,4)+"<br>");
? document.write(" 6 和 3 的較大值是:"+max(6,3) );?
</script>
</head>
<body>
</body>
</html>
運行結果:
2020-11-27
//定義函數
var biger1=bj(5,4);
var biger2=bj(9,3);
//函數體,判斷兩個整數比較的三種情況
function bj(x,y){
? ? if(x>y){
? ? ? ?return x;?
? ? }else if(y>x){
? ? ? ? return y;
? ? }else{
? ? ? ? return "一樣大";
? ? }
}
//調用函數,實現下面兩組數中,返回較大值。
? document.write(" 5 和 4 的較大值是:"+biger1+"<br>");
? document.write(" 6 和 3 的較大值是:"+biger2 );?