这是我的编码..我做了什么错误。我在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