Php 使用window.location.reload(url)重新加载页面后未选择jquery选项卡

Php 使用window.location.reload(url)重新加载页面后未选择jquery选项卡,php,jquery,jquery-tabs,Php,Jquery,Jquery Tabs,当我单击页面上的刷新按钮时,重新加载的页面似乎没有像通常在刷新或重新加载页面时那样选择第一个选项卡 我的jquery选项卡是按照您通常在任何地方都可以找到的方式设置的 有什么想法吗 <head> <script type="text/javascript" src="js/jquery-1.4.2.js"></script> </head> jQuery选项卡函数 好的,我改变了它的工作方式,我想在它被动态创建之前,我试图在重载时显示为选

当我单击页面上的刷新按钮时,重新加载的页面似乎没有像通常在刷新或重新加载页面时那样选择第一个选项卡

我的jquery选项卡是按照您通常在任何地方都可以找到的方式设置的

有什么想法吗

<head>
    <script type="text/javascript" src="js/jquery-1.4.2.js"></script>
</head>
jQuery选项卡函数


好的,我改变了它的工作方式,我想在它被动态创建之前,我试图在重载时显示为选项卡部分。我现在已经删除了它,jquery现在似乎正在加载ok。因此,用户必须从下拉列表中选择一个选项,但目前这还可以

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simple tabs</title>
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<style type="text/css">
li{
    float:left;
    margin-left:20px;
}
</style>
</head>

<body>
<script type="text/javascript">
    $(document).ready(function(){
        var myCookie = document.cookie.replace(/(?:(?:^|.*;\s*)test2\s*\=\s*([^;]*).*$)|^.*$/, "$1");

        switch(myCookie){
            case "undefined":
                tab_1();
                break;
            case "tab1":
                tab_1();
                break;
            case "tab2":
                tab_2();
                break;
            case "tab3":
                tab_3();
                break;
        }
    });

    function tab_1(id){
        $('.tab-1cont').show();
        $('.tab-2cont').hide();
        $('.tab-3cont').hide();
        document.cookie = "test2="+id;
    }

    function tab_2(id){
        $('.tab-1cont').hide();
        $('.tab-2cont').show();
        $('.tab-3cont').hide();
        document.cookie = "test2="+id;
    }

    function tab_3(id){
        $('.tab-1cont').hide();
        $('.tab-2cont').hide();
        $('.tab-3cont').show();
        document.cookie = "test2="+id;
    }
</script>

<ul>
    <li onclick="tab_1(id)" id="tab1" class="tab_001">Tab-1</li>
    <li onclick="tab_2(id)" id="tab2" class="tab_002">Tab-2</li>
    <li onclick="tab_3(id)" id="tab3" class="tab_003">Tab-3</li>
</ul>

<div style="clear:both"></div>
<div class="tab-1cont"><h1>Tab 1 container</h1></div>
<div class="tab-2cont"><h1>Tab 2 container</h1></div>
<div class="tab-3cont"><h1>Tab 3 container</h1></div>

事实上,所有jQuery都没有重新加载……一些代码会很好。我不想闯进你家去调试代码,再一次…代码添加了。刷新后似乎会重新加载JQuery…+1对于Blender的精彩评论:哈哈…就像我说的差不多是标准的JQuery标签代码。你能解释一下你的答案吗?
 <input type="button" id="btnRefresh" value="Refresh" onclick="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);        
}
<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>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simple tabs</title>
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<style type="text/css">
li{
    float:left;
    margin-left:20px;
}
</style>
</head>

<body>
<script type="text/javascript">
    $(document).ready(function(){
        var myCookie = document.cookie.replace(/(?:(?:^|.*;\s*)test2\s*\=\s*([^;]*).*$)|^.*$/, "$1");

        switch(myCookie){
            case "undefined":
                tab_1();
                break;
            case "tab1":
                tab_1();
                break;
            case "tab2":
                tab_2();
                break;
            case "tab3":
                tab_3();
                break;
        }
    });

    function tab_1(id){
        $('.tab-1cont').show();
        $('.tab-2cont').hide();
        $('.tab-3cont').hide();
        document.cookie = "test2="+id;
    }

    function tab_2(id){
        $('.tab-1cont').hide();
        $('.tab-2cont').show();
        $('.tab-3cont').hide();
        document.cookie = "test2="+id;
    }

    function tab_3(id){
        $('.tab-1cont').hide();
        $('.tab-2cont').hide();
        $('.tab-3cont').show();
        document.cookie = "test2="+id;
    }
</script>

<ul>
    <li onclick="tab_1(id)" id="tab1" class="tab_001">Tab-1</li>
    <li onclick="tab_2(id)" id="tab2" class="tab_002">Tab-2</li>
    <li onclick="tab_3(id)" id="tab3" class="tab_003">Tab-3</li>
</ul>

<div style="clear:both"></div>
<div class="tab-1cont"><h1>Tab 1 container</h1></div>
<div class="tab-2cont"><h1>Tab 2 container</h1></div>
<div class="tab-3cont"><h1>Tab 3 container</h1></div>