這是我的編碼..我做了什麼錯誤。我在6號,它不工作有人可以看看這個,給我一些幫助。? 感謝首頁工作幫助我被困在NUmber 6 Window.prompt()步驟
<html>
<head>
<title> My Homework </title>
</head>
<body>
<div style="width:400px; height:200px" id="firstdiv">
<br /> <br /><center>Well Hi there! <br/> Answer the prompt to see what happens next.</center>
</div>
<script type="text/javascript">
var moquestion = window.prompt("What is the capital of Missouri?","");
if (moquestion.length < 1) {
<div style="width:400px; height:200px" id="sorrydiv">
<br /> <br /> <h1><center>Sorry you don't feel like playing.<br />The capital of Missouri is Jefferson City</center></h1>
</div>
}
</script>
</body>
</html>
下面是分配
- 創建所有基本的HTML標記的網頁。
- 在
<body>
的內部,使用元素ID創建一個<div>
標籤。 - 將一些文字插入
<div>
標籤。 - 將此腳本添加到此
<div>
以下,以便它不會嘗試運行,直到已加載。 - 使用window.prompt方法詢問「什麼是密蘇里州的首府?」確保沒有默認答案顯示給用戶。
- 檢查以確保返回的字符串的長度屬性不小於1.如果爲空,則在
<div>
標籤中寫下如下內容:「對不起,您不喜歡玩。密蘇里州首府傑斐遜城「 - 如果字符串不爲空,則使用window.confirm方法向用戶詢問:‘這是你最後的答案’
- 如果他們證實,寫類似於字符串?下面加入標籤:「密蘇里州的首府是」+ myanswer +「。所以你說。「
- 如果他們取消了,再次提問:」那麼密蘇里州的首都是什麼?「這一次,寫出答案沒有錯誤檢查。
謝謝你的幫助..你們都認真幫助了我。我感到困惑,無法擺脫思路!那你直接指引我吧! – JBSAMOM 2013-03-31 00:58:08