选项卡代码问题:刷新页面保持原来选项,怎么做?
选项卡代码问题:刷新页面保持原来选项,怎么做?以下是选项卡的js
<script type="text/javascript">
function nTabs(thisObj, Num) {
if (thisObj.className == "active") return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for (i = 0; i < tabList.length; i++) {
if (i == Num) {
thisObj.className = "active";
document.getElementById(tabObj + "_Content" + i).style.display = "block";
} else {
tabList[i].className = "normal";
document.getElementById(tabObj + "_Content" + i).style.display = "none";
}
}
}
</script>
<div class="nTab">
<div class="TabTitle">
<ul id="myTab1">
<li class="active" onclick="nTabs(this,0);">注册</li>
<li class="normal" onclick="nTabs(this,1);">登录</li>
</ul>
</div>
<div class="TabContent">
<div id="myTab1_Content0">注册</div>
<div id="myTab1_Content1" class="none">登录</div>
</div>
现在的问题就是在登录选项卡刷新的时候就回到了默认的注册页面,我想刷新当前登录选项卡该怎么写呀???求高手帮忙呀,我JS不怎么好,感激不尽!
------解决方案--------------------
<script type="text/javascript">
function nTabs(thisObj, Num) {
if (thisObj.className == "active") return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for (i = 0; i < tabList.length; i++) {
if (i == Num) {
thisObj.className = "active";
&