答案 0 :(得分:0)
使用localStorage。
<div id="hide4ever" style="display:none">text
<button onclick="hideNow()">close</button>
</div>
<script>
if (!localStorage.hide4ever)
document.getElementById('hide4ever').style.display = "fixed";//or whatever
function hideNow() {
document.getElementById('hide4ever').style.display = "none";
localStorage.hide4ever="true";
}
</script>