Tabs提交无刷新
页面用一个控件放TabIndex
<asp:HiddenField ID="hidTabIndex" runat="server" />
Tab如下定义:
<div id="rotate">
<ul>
<li><a href="#fragment-1"><span>GPS基本资料</span></a></li>
<li><a href="#fragment-2"><span>GPS回收</span></a></li>
</ul>
</div>
在查询的js代码中,
function setSelectedTabIndex() {
var tabIndex = 0;
var curId = $(".ui-tabs-selected").children().attr("href");
if (curId.length > 0) {
tabIndex = Number($(".ui-tabs-selected").children().attr("href").substr($(".ui-tabs-selected").children().attr("href").length - 1, 1)) - 1;
}
$("#hidTabIndex").val(tabIndex);
}
在页面加载中,
var tabIndex = $("#hidTabIndex").val();
if (tabIndex == "" || tabIndex == null)
tabIndex = 0;
$('#rotate > ul').tabs({ fx: { opacity: 'toggle' }, selected: tabIndex });
搞定,哈哈