哪里錯了,為啥沒有顯示?
<!DOCTYPE? HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>函數(shù)</title>
<script type="text/javascript">
function compare(a,b)//定義函數(shù)
{
? ? if (a>b)
? ? {
? ? ? ? return a;
? ? }
? ? else if(a<b)
? ? {
? ? ? ? return b;
? ? }else
? ? {return "兩數(shù)相等"}
? ??
}//函數(shù)體,判斷兩個整數(shù)比較的三種情況
?
//調(diào)用函數(shù),實現(xiàn)下面兩組數(shù)中,返回較大值。
? document.write(" 5 和 4 的較大值是:"+compare(5,4)+"<br/>");
? document.write(" 6 和 3 的較大值是:"+compare(6,3)+"<br/>" );?
? document.write(" 88 和88 的較大值是:"+compare(88,88) );?
</script>
</head>
<body>
</body>
</html>
2019-04-04
而且document.write(" 6 和 3 的較大值是:"+compare(6,3)+"<br/>" );里面有中文符號,第二個3后面
2019-04-04
{return "兩數(shù)相等";}
你的這一行代碼寫少了一個分號