答案......
<!DOCTYPE? HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>函數(shù)</title>
<script type="text/javascript">
//定義函數(shù)
function bj(x,y){
? ? if(x>y){
? ? ? ? z=x
? ? }else if(x<y){
? ? ? ? z=y
? ? }else{
? ? ? ? z="兩數(shù)相等"
? ? }
? ? return z;
}
//函數(shù)體,判斷兩個整數(shù)比較的三種情況
a=bj(5,4);
b=bj(4,7);
c=bj(2,2)
?
//調(diào)用函數(shù),實現(xiàn)下面兩組數(shù)中,返回較大值。
? document.write(" 5 和 4 的較大值是:"+a+"<br>");
? document.write(" 4 和 7 的較大值是:"+b+"<br>");
? document.write(" 2 和 2 的較大值是:"+c );?
</script>
</head>
<body>
</body>
</html>
2022-06-07
<!DOCTYPE? HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>函數(shù)</title>
<script type="text/javascript">
//定義函數(shù)
function add4(x,y){
? if(x>y){
? ? ?return x;?
? }? else if(x<y){
? ? ? return y;
? }else{
? ? ? return("兩數(shù)相等!");
? }
}
//函數(shù)體,判斷兩個整數(shù)比較的三種情況
?
//調(diào)用函數(shù),實現(xiàn)下面兩組數(shù)中,返回較大值。
? document.write(" 5 和 4 的較大值是:"+add4(5,4)+"<br>");
? document.write(" 6 和 3 的較大值是:"+add4(6,3) );?
</script>
</head>
<body>
</body>