我是编程新手,我自学HTML和Javascript以及python。 我在学习这些语言方面得到了一点,我觉得我可以使用javascript在html中处理其中一件事情。 我遇到了一个问题,无论出于何种原因,我的代码根本无法工作。 我仔细检查了一切,我很确定它都在正确的位置,所有的字符都是正确的。 这是我的代码到目前为止,完整。我仍处于开发早期阶段,我知道这还不完整。为什么我的脚本不能在这个html文档中工作?
<!doctype html>
<html>
<head>
<title>Python game</title>
</head>
<body>
<p>Enter your choice by clicking on the buttons below the paragraph<p>
<p id="newText">kjgkhg</p>
<button type="onClick" id="ChooseFirst">First choice</button>
<button type="onclick" id="chooseSecond">Second choice</button>
<button type="onclick" id="choosethird">Third choice</button>
<script>
document.getElementById("newText").innerHTML = "why doesn't this work?";
funciton darkRoom() {
vars x=document.getElementById("newText").innerHTML ;
document.getElementById("newText").innerHTML = "You wake up in a dark room with no \
idea how you go there. You can make out the outline of three doors\
labeled '1', '2', and '3' directly in front of you. There is no door behind you.\
Which door do you enter?";
}
function lions() {
}
function tiger() {
}
functoin bear() {
}
function brickRoad() {
}
function quickSand() {
}
function sizePuzzle() {
}
function riddlesOnWall() {
}
function wolfSheepCabbage() {
}
function duckHunt() {
}
function hangman() {
}
function goldRoom() {
}
function ocean {
}
function winScreen() {
}
function youDie() {
}
</script>
</body>
</html>
发挥你有很多简单的错别字在你的代码。另外,javascript区分大小写 –
打开浏览器的JavaScript控制台。错误在那里打印。 – JJJ
虽然我在这里正确使用骆驼案例。在区分大小写的情况下我搞砸了什么? – Steve