这是我的代码示例
<head id="Head1" runat="server">
<title>Customer Application Form ::Corporate</title>
<link rel="stylesheet" type="text/css" href="css/tabcontent.css" />
<link rel="stylesheet" type="text/css" href="css/default.css" />
<script type="text/javascript" src="js/tabcontent.js"></script>
<script>
// store the currently selected tab in the hash value
$("ul.tabs > li > a").on("shown.bs.tab", function (e) {
var id = $(e.target).attr("href").substr(1);
window.location.hash = id;
});
// on load of the page: switch to the currently selected tab
var hash = window.location.hash;
$('#ulid a[href="' + hash + '"]').tab('show');
</script>
</head>
<body>
<form id="Form1" runat="server" class="register">
<div id="tabs">
<ul id="ulid" class="tabs">
<li>
<a href="#Tab1" id="One" class="dtls">Text A</a>
</li>
<li>
<a href="#Tab2" id="Two" class="dtls">Text B</a>
</li>
<li>
<a href="#Tab3" id="Three" class="dtls">Text C</a>
</li>
</ul>
<p> </p>
<div id="Tab1">Content AAAAAAAAAAAAAAAAAAAA</div>
<div id="Tab2">Content BBBBBBBBBBBBBBBBBBBB</div>
<div id="Tab3">Content CCCCCCCCCCCCCCCCCCCC</div>
</div>
<a href="javascript:location.reload();">
<h1>Reload page</h1></a>
</form>
如果我在页面内选择了任何选项卡并在重新加载页面后选择了 Tab1。无论是否选择了默认 Tab1,我都想保留在已选择的选项卡上(例如 Tab4)。