为什么我的javascript不能工作?(html5游戏开发)

Why isn't my javascript working ? (html5 game dev

本文关键字:html5 游戏 开发 我的 javascript 不能 工作 为什么      更新时间:2023-09-26

我已经试着找出我的错误一个多小时了,我不知道为什么这个故事没有输出。本教程来自"HTML5游戏开发的傻瓜",它看起来像我已经复制的例子,但它仍然不工作

CSS: http://pastebin.com/DngEJh4t
JavaScript: http://pastebin.com/hvq3Sukg

HTML文件如下:

<!DOCTYPE HTML>
    <html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <title>wordstory.html</title>
        <link rel = "stylesheet" type = "text/css" href ="wordStory.css"/>
        <script type="text/javascript" src = "wordStory.js">
        </script>
    </head>
    <body>
    <h1>Word Story</h1>
    <form action=" ">
        <fieldset>
            <label for = "txtBoy">Boy's name</label>
            <input type = "text" id = "txtBoy" />
            <label for = "txtGirl">Girl's name</label>
            <input type = "text" id = "txtGirl" />
            <label for = "txtGeol">Geological formation</label>
            <input type = "text" id = "txtGeol" />
            <label for = "txtVerb">Verb</label>
            <input type = "text" id = "txtVerb" />
            <label for = "txtContainer">Container</label>
            <input type = "text" id = "txtContainer" />
            <label for = "txtLiquid">Liquid</label>
            <input type = "text" id = "txtliquid" />
            <label for = "txtPart">Body Part</label>
            <input type = "text" id = "txtPart" />
            <label for = "txtGerund">ing Verb</label>
            <input type = "text" id = "textGerund" />
            <button type = "button" onclick = "tellStory()">
                tell the story
            </button>
        </fieldset>
    </form>
    <div id = "output"></div>       
    </body>
    </html>

id = "txtliquid"应为id = "txtLiquid", id = "textGerund"应为id = "txtGerund"

演示:http://jsfiddle.net/Guffa/60f562kL/