Javascript函数在Wordpress post中不起作用
以下代码在我的计算机上运行良好。然而,当我将其粘贴到wordpress帖子中时,按钮会显示,但不起作用。我需要在Wordpress中调整什么才能让它工作?短暂性脑缺血发作Javascript函数在Wordpress post中不起作用,javascript,html,wordpress,Javascript,Html,Wordpress,以下代码在我的计算机上运行良好。然而,当我将其粘贴到wordpress帖子中时,按钮会显示,但不起作用。我需要在Wordpress中调整什么才能让它工作?短暂性脑缺血发作 <div id="quoteDisplay"> </div> <button onclick="newQuote()">New Quote</button> <script> var quotes = [
<div id="quoteDisplay">
</div>
<button onclick="newQuote()">New Quote</button>
<script>
var quotes = [
'Quote test 1',
'Quote test 2',
'Quote test 3',
'Quote test 4',
'Quote test 5',
'Quote test 6',
'Quote test 7',
'Quote test 8',
'Quote test 9',
'Quote test 10',
'Quote test 11',
'Quote test 12',
'Quote test 13',
'Quote test 14',
]
function newQuote() {
var randomNumber = Math.floor(Math.random() * (quotes.length));
document.getElementById('quoteDisplay').innerHTML = quotes[randomNumber];
}
</script>
新报价
变量引号=[
“引用测试1”,
“报价测试2”,
“引用测试3”,
“报价测试4”,
“引用测试5”,
“引用测试6”,
“引用测试7”,
“引用测试8”,
“引用测试9”,
“引用测试10”,
“引用测试11”,
“引用测试12”,
“引用测试13”,
“引用测试14”,
]
函数newQuote(){
var randomNumber=Math.floor(Math.random()*(quotes.length));
document.getElementById('quoteDisplay')。innerHTML=quotes[randomNumber];
}
代码>用于报价
变量