放几个微信号 45648 1231 456 然后网页加载一次这几个会轮换显示!怎么能让另外一个人加载时不从头显示!
下面是源码<html><head></head><body><pid="wechat"></p><script>varwechatIds=['45648','1231',...
下面是源码
<html>
<head></head>
<body>
<p id="wechat"></p>
<script>
var wechatIds = ['45648', ' 1231', '456'],
wechatIdsKey = 0;
if (window.localStorage.getItem('wechatIdsKey') == null) {
window.localStorage.setItem('wechatIdsKey', 0);
} else {
wechatIdsKey = window.localStorage.getItem('wechatIdsKey');
wechatIdsKey++;
if (wechatIdsKey >= wechatIds.length) {
wechatIdsKey = 0;
}
window.localStorage.setItem('wechatIdsKey', wechatIdsKey);
}
document.getElementById('wechat').innerHTML = wechatIds[wechatIdsKey];
</script>
</body>
</html>
最好能接着上个人刷新到的位置,接着显示! 展开
<html>
<head></head>
<body>
<p id="wechat"></p>
<script>
var wechatIds = ['45648', ' 1231', '456'],
wechatIdsKey = 0;
if (window.localStorage.getItem('wechatIdsKey') == null) {
window.localStorage.setItem('wechatIdsKey', 0);
} else {
wechatIdsKey = window.localStorage.getItem('wechatIdsKey');
wechatIdsKey++;
if (wechatIdsKey >= wechatIds.length) {
wechatIdsKey = 0;
}
window.localStorage.setItem('wechatIdsKey', wechatIdsKey);
}
document.getElementById('wechat').innerHTML = wechatIds[wechatIdsKey];
</script>
</body>
</html>
最好能接着上个人刷新到的位置,接着显示! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询