我有一個aspx頁面,它有三個選項卡。當我點擊tab3中的一個按鈕時,會發生一個回傳,它會將我帶回到tab1。我如何留在tab3中? 以下是我的aspx頁面。另外我注意到我們有一個JavaScript來將活動標籤設置爲tab1。任何人都可以告訴我如何修改它,以便在回發期間將選定的選項卡設置爲活動選項卡?如何在回發期間留在選定的選項卡中?
<script type="text/javascript">
$(document).ready(function() {
//When page loads...
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
});
<div id="content">
<ul class="tabs">
<li><a href="#tab1">Edit</a></li>
<li><a href="#tab2">History</a></li>
<li><a href="#attachmentcontent">Attachments</a></li>
</ul>
<div class="tab_container">
<div id="tab1" class="tab_content">
...
我已通過使用隱藏字段解決了該問題。我無法在這裏發佈我的jQuery腳本。如果有人想要幫助,請給我發電子郵件。 – GLP