在尝试调试时,我收到此行的“长度”空错误。它是按照书上的说明写的,所以我不明白为什么它会给我错误?谢谢,=)
if (capital.length < 1) {
(这是所要求的完整代码..抱歉)
<script type="text/javascript">
var capital = window.prompt("What is the capital of Missouri?","")
if (capital.length < 1) {
document.getElementById("firstdiv").innerHTML="Sorry you don't feel like playing.<br /> The Capital of Missouri is Jefferson City.";
}
else {
if (!window.confirm("Is that your final answer?")){ return true;
document.getElementById("firstdiv").innerHTML = "The capital of Missouri is: <bold>" + capital + "</bold>, so says you.";
}
else{
return false;
}
}
</script>