1
我已經注意到與警報功能,你不能改變標題或出於安全原因添加圖像,但我仍然需要類似的東西,因爲我正在製作我的遊戲,所以我決定做一個div,但我需要它懸停在整個頁面上,但正如你將在代碼片段中看到的,它看起來在頁面下方還沒有結束,有人可以告訴我如何解決這個問題。 使一個div浮動其他內容
//the function for the button
var no = function(){
//the div
var div= document.createElement("div");
div.style.height="400px";
div.style.background="red";
div.innerHTML="<h1>what!</h1><p>im not alive</p>";
document.body.appendChild(div);
};
<!--what i want the div to hover over-->
<h1>hello world</h1>
<p>am i alive</p>
<button onclick="no()">press me to find out</button>