怎么沒有輸出
<!DOCTYPE ?HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>函數(shù)</title>
<script type="text/javascript">
//定義函數(shù)
function compare(x,y)
{
? ? if(x>y)
? ? ? return x;
? ? else ?
? ? ? ?if(x<y)?
? ? ? ? ? ? ?return y;
? ? ? ? else return "兩數(shù)相等";
? ? ? ? ??
}
?
? document.write(" 5 和 4 的較大值是:"+compare(5,4)+"<br>");
? document.write(" 6 和 3 的較大值是:"+compare(6,3)+"<br>" );
? document.write("4 和 4 的較大者是:"+compare(4,4));
</script>
</head>
<body>
</body>
</html>
2017-06-28
if(條件語(yǔ)句){
如果條件為true
執(zhí)行這里的語(yǔ)句
}else if(條件語(yǔ)句){
如果條件為true
執(zhí)行這里的語(yǔ)句
}?else{
否則執(zhí)行這里的語(yǔ)句
}
2017-05-16
if后的語(yǔ)句要打{},定義函數(shù)那一段改成
//定義函數(shù)
function compare(x,y)
{
? ? if(x>y){
? ? ? return x;}
? ? else if(x<y) {
? ? ? ? ? ? ?return y;}
? ? ? ? else{ return "兩數(shù)相等";}
? ? ? ? ??
}
2017-04-23
紅框里的分號(hào) 換成英文分號(hào)就可以運(yùn)行了
2017-04-22
下面的提交按鈕旁邊有個(gè)“自動(dòng)運(yùn)行”的復(fù)選框,勾選上它試試