我有一个脚本,点击按钮后显示随机引号。请帮我理解它为什么不起作用。行情脚本不起作用
function quotes() {
var aquote = new Array;
aquote[0] = "\"Nobody exists on purpose. Nobody belongs anywhere. We're all
going to die.Come watch TV.\"";
aquote[1] = "\"Listen, Morty, I hate to break it to you but what people call
love is just a chemical reaction that compels animals to breed.It hits
hard, Morty, then it slowly fades, leaving you stranded in a failing
marriage.I did it.Your parents are gonna do it.Break the cycle, Morty.
Rise above.Focus on science."\"";
aquote[2] = "\"Weddings are basically funerals with cake.\""
aquote[3] = "\"There is no God, Summer. Gotta rip that band-aid off now
you’ ll thank me later.\""
aquote[4] = "\"I’m sorry, but your opinion means very little to me.\""
aquote[5] = "\"Being nice is something stupid people do to hedge their
bets.\""
rdmQuote = Math.floor(Math.random() * aquote.length);
document.getElementById("quote").value = aquote[rdmQuote];
}
window.onload = quotes;
<marquee><p id="quote"></p></marquee>
的可能的复制[声明一个字符串VAR在JavaScript中多行/jQuery](https://stackoverflow.com/questions/21202782/declare-a-string-var-with-multiple-lines-in-javascript-jquery) – CBroe
另一种可能的重复:[“.innerHTML”和“ .value“in JS](https://stackoverflow.com/q/31225901/8173752) –
JavaScript中的文本文字不能只从一行到另一行 - 在这方面检查重复。你自己用你的浏览器的开发工具,特别是控制台 - 它已经告诉你,你在那个部分有一个错误,所以你可能没有希望更有目的地研究这一点。 – CBroe