<button onclick="reset()">按钮</button>
<script type="text/javascript">
function reset(){
$("#abc").load(location.href + " #abc")
}
</script>
需要使用本地存储localStorage或者cookie,能够在html页面当中实现刷新轮流出现数值
<div id="box">内容</div><script>
var box = document.getElementById('box')
var arr = ['小明', '小红']
if (!localStorage.num || localStorage.num == 0) {
localStorage.num = 1
} else {
localStorage.num = 0
}
box.innerHTML = arr[localStorage.num]
</script>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)