我的代碼到底哪里有問題?
<!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 "一樣大";
?}
else{
return b;
}
?}
?document.write(" 5 和 4 的較大值是:"+"compare(5,4)"+"<br>");
?document.write(" 6 和 3 的較大值是:"+"compare(6,3)" );?
</script>
</head>
<body>
</body>
</html>
我的代碼到底哪里有問題,為什么瀏覽器讀不出來???
2015-09-04
二個問題
1 代碼中標(biāo)點應(yīng)該為英文而不是中文(return "一樣大";)
2 連接函數(shù)不應(yīng)該用""引起來"compare(6,3)"