Jquery tab disabling
I am using jquery tab. I want to disable the tabs when the form is in edit mode.
Iam using a query string id
for this and type
for identifying the tab
According to the value of id the tab is disabled. Iam using following code
$(doc开发者_JAVA百科ument).ready(function() {
var id = getQuerystring("Id");
if (isNaN(id)) {
var inx = getQuerystring("type");
if (isNaN(inx))
inx = 1;
inx = inx - 1;
$('#tabs').tabs();
}
else {
var inx = getQuerystring("type");
if (isNaN(inx))
inx = 1;
inx = inx - 1;
$('#tabs').tabs();
$('#tabs').tabs('select', inx);
if (!isNaN(id)) {
for (var cnt = 0; cnt < 6; cnt++) {
$('#tabs').tabs('disable', cnt);
if (cnt == (inx)) {
$('#tabs').tabs();
$('#tabs').tabs('select', cnt);
}
}
}
}
if (inx == 0)
LoadIframePage('CashReceipt.aspx?type1=1');
else if (inx == 1)
LoadIframePage('CashPayment.aspx?type1=2');
else if (inx == 2)
LoadIframePage('BankDeposit.aspx?type1=3');
else if (inx == 3)
LoadIframePage('BankWithDrawal.aspx?type1=4');
else if (inx == 4)
LoadIframePage('Journal.aspx?type1=5');
});
<div id="tabs" style="font-size: 12px; width: 100%; height: 100%; visibility:hidden" onload="SelectaTab(2);">
<ul>
<li><a id="cr" href="#fragment" onclick="LoadIframePage('CashReceipt.aspx?type1=1')"><span>Cash Receipt</span></a></li>
<li><a id="cp" href="#fragment" onclick="LoadIframePage('CashPayment.aspx?type1=2')"
><span>Cash Payment</span></a></li>
<li><a id="br" href="#fragment" onclick="LoadIframePage('BankDeposit.aspx?type1=3')"><span>Bank Receipt</span></a></li>
<li><a id="bw" href="#fragment" onclick="LoadIframePage('BankWithDrawal.aspx?type1=4')"><span>Bank Payment</span></a></li>
<li><a id="jr" href="#fragment" onclick="LoadIframePage('Journal.aspx?type1=5')"><span>Journal</span></a></li>
</ul>
<div id="fragment" style="width: 100%; height: 90%">
<iframe style="width: 98%; height: 100%" frameborder="0" scrolling="yes" id="ifrforms" onload="test">
</iframe>
</div>
</div>
My pblm is that tabs are disabled . but while clicking on the tab the page is redirected and that page is loaded...How can i solve this.
Thanks in advance
Where is the function LoadIframePage defined? Could you put an if statement in there like so:
if( $('#tabs').attr("disabled") ) {
return; // do nothing
} else {
// carry on...
}
精彩评论