TypeError:未定义document.quoteform

时间:2015-10-08 04:51:55

标签: javascript html5

我对我的代码有这个棘手的问题,我认为这是一个运行时错误,因为它在我运行程序并实际停止时出现。我使用错误控制台向我显示错误的位置,但我无法理解它。如果有人能指出我正确的方向而没有给我答案,我会很感激。这是代码:

<script type="text/javascript">
     <!-- HIDE FROM INCOMPATIBLE BROWSERS
     function changeQuote() {
     quotes = new Array;
     quotes[0] = "Laughter is the best medicine.";
     quotes[1] = "Never look a gift horse in the mouth.";
     quotes[2] = "One good turn deserves another.";
     quotes[3] = "The early bird catches the worm.";
     quotes[4] = "Two is company, three is a crowd.";
     var newQuote = quotes[Math.round(Math.random()+quotes.length)];
     document.quoteform.quote.value = newQuote;
     }
     var tick = setInterval("changeQuote()");
     // STOP HIDING FROM INCOMPATIBLE BROWSERS -->
     </script>
     </head>
     <body>
     <form action=""name="">
     <input type="text" size="50" name="quote" /><br />
     </form>
     </body>
     </html>

我还有两个错误控制台消息的图像:enter image   description here

0 个答案:

没有答案