我有以下代码:
<script type="text/javascript">
var Value = new Date();
var min = Value.getHours();
setTimeout ("Timeout()", 1);
function Timeout ()
{
for (var i = 0; i <= 15; i++) {
var x = document.getElementsByClassName("d")[i];
x.innerHTML = (min + ":" + "0" );
};
min--;
setTimeout ("Timeout()", 1000);
}
</script>
<p class="d"></p>
现在我的问题是每次刷新页面时变量都会重置。有没有办法在一定时间内设置一次变量,所以它不会被重置?谢谢