嗨,我的网站工作正常(bureaudonald.com)。添加<meta http-equiv="Content-Security-Policy" content="default-src https:">
这是代码。有人知道我需要改变什么才能让它发挥作用吗?
function GetValue()
{
var myarray= new Array(
"Why are we doing this?",
"Why are we making this?",
"Why would we add this?",
"etc"
);
var random = myarray[Math.floor(Math.random() * myarray.length)];
document.getElementById("message").innerHTML=random;
}
<!-- WHY -->
<div class="main why_loader" id="whysection">
<section data-navlink="navwhy">
<div class="why">
<div class="why_content">
<div class="why_field">
<span class="why_title" id="message">Ask Why!<br/>And Ask it Again<br/>And again</span>
</div>
<div class="why_button">
<button class="why_btn" onclick="GetValue();">Ask Why Again!</button>
</div>
</div>
<h2> </h2>
</div>
</section>
</div>