好吧,我有點卡在這一個。我在看我的書。我很確定我想這個聲明
我在想我應該使用if或else語句。當我嘗試驗證它會出現3個錯誤。有人可以指出我錯過的提示嗎?
謝謝。我還沒有在JavaScript這麼遠。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" href="js_styles.css" type="text/css" />
<script type="text/javascript">
//<![CDATA[
<!--HIDE FROM INCOMPATIBLE BROWERS
function checkGrade(grade) {
switch(grade) {
case "A":
document.write("Your grade is excellent.");
break;
case "B":
document.write("Your grade is good.");
break;
case "C":
document.write("Your grade is fair.");
break;
case"D":
document.write("You are barely passing.");
break;
case"F":
document.write("you failed.");
break;
defult:
document.write("You did not enter a valid letter grade.")
break;
}
}
//STOP HIDING INCOMPATIBLE BROWERS-->
//]]>
</script>
</head>
<body
<form name ="gradeForm" "action" ="">
<input type="text" name="grade" />
<input type="button" value="CheckGrade" onclick="checkGrade(document.gradeForm.grade.value);" />
</form>
</body>
</html>
你們怎麼看到什麼?我看到一個開頭的段落,然後「// //]]>」。我正在使用Chrome。 – ClosureCowboy 2011-02-15 03:07:09
@Closure:他編輯的問題,緩存也許? – JCOC611 2011-02-15 03:07:54
@ jcoc611在編輯之前加載我的頁面。 – ClosureCowboy 2011-02-15 03:08:41