使用 window.location.reload(url) 重新加载页面后未选择 jquery 选项卡
当我单击页面上的刷新按钮时,重新加载的页面似乎没有像通常刷新或重新加载页面那样选择第一个选项卡?
我的 jquery 选项卡的设置与您通常在任何地方找到的一样。
有什么想法吗?
<head>
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
</head>
选项卡
<div class="tabs">
<ul class="tabNavigation">
<li><a href="#priority">Priority</a></li>
<li><a href="#urgent">Urgent</a></li>
<li><a href="#potential">Potential</a></li>
<li style="margin-left:75px"> </li>
</ul>
<div id="priority">
</div>
<div id="urgent">
</div>
<div id="potential">
</div>
</div>
按钮调用
<input type="button" id="btnRefresh" value="Refresh" onclick="do_refresh()"/>
do_refresh函数
function do_refresh()
{
var man_num = document.getElementById('txtOpCode').value;
var ps=document.getElementById('drpSect').value;
var url = "auto.php?v=l&man_num="+man_num+"&ps="+ps;
window.location.reload(url);
}
jQuery选项卡函数
<script type="text/javascript" charset="utf-8">
$(function () {
var tabContainers = $('div.tabs > div');
tabContainers.hide().filter(':first').show();
$('div.tabs ul.tabNavigation a').click(function () {
tabContainers.hide();
tabContainers.filter(this.hash).show();
$('div.tabs ul.tabNavigation a').removeClass('selected');
$(this).addClass('selected');
return false;
}).filter(':first').click();
});
</script>
When I click a refresh button on my page the page that reloads doesn't seem to be selectiung the first tab as it usually does with a refresh or reload page?
My jquery tabs are set up as you'd normally find anywhere.
Any ideas?
<head>
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
</head>
tabs
<div class="tabs">
<ul class="tabNavigation">
<li><a href="#priority">Priority</a></li>
<li><a href="#urgent">Urgent</a></li>
<li><a href="#potential">Potential</a></li>
<li style="margin-left:75px"> </li>
</ul>
<div id="priority">
</div>
<div id="urgent">
</div>
<div id="potential">
</div>
</div>
Button call
<input type="button" id="btnRefresh" value="Refresh" onclick="do_refresh()"/>
do_refresh function
function do_refresh()
{
var man_num = document.getElementById('txtOpCode').value;
var ps=document.getElementById('drpSect').value;
var url = "auto.php?v=l&man_num="+man_num+"&ps="+ps;
window.location.reload(url);
}
jQuery tabs function
<script type="text/javascript" charset="utf-8">
$(function () {
var tabContainers = $('div.tabs > div');
tabContainers.hide().filter(':first').show();
$('div.tabs ul.tabNavigation a').click(function () {
tabContainers.hide();
tabContainers.filter(this.hash).show();
$('div.tabs ul.tabNavigation a').removeClass('selected');
$(this).addClass('selected');
return false;
}).filter(':first').click();
});
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我改变了它的工作方式,我想在动态创建它之前尝试在重新加载时显示为选项卡部分。我现在已经删除了它,并且 jquery 现在似乎可以正常加载。因此,用户必须从下拉列表中选择一个选项,但目前还可以。
Ok I changed the way this works and I was trying to display as tab section on reload I think before it had been dynamically created. I've now removed that and jquery appears to be loading ok now. So the user will have to select an option from the dropdown but for now that is ok.