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

时间:2015-08-02 10:33:26

标签: javascript css html5

我现在试图找出我的错误超过一个小时,我无法弄清楚为什么这个故事不会被输出。本教程来自" 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>

1 个答案:

答案 0 :(得分:0)

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

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