如何使按钮在24小时后重新出现

时间:2017-04-16 05:44:42

标签: javascript

我有以下代码隐藏按钮,但我想在24小时后再次显示该按钮。我该怎么做?

<input type="button" id="points" value="Points" onClick="action();" />

<script>
var hidden = false;
function action() {
    hidden = !hidden;
    if(hidden) {
        document.getElementById('points').style.visibility = 'hidden';
    }
}
</script>

1 个答案:

答案 0 :(得分:-1)

<input type="button" id="toggler" value="Toggler" onClick="action();" />
<input type="button" id="togglee" value="Togglee" />

<script>
    var hidden = false;
    function action() {
        hidden = !hidden;
        if(hidden) {
            document.getElementById('togglee').style.visibility = 'hidden';
        } else {
            document.getElementById('togglee').style.visibility = 'visible';
        }
    }
</script>