0

我正在开发一个暗示 php、javascript 和 jquery 的网站。它有 2 个标签和第二个标签内的手风琴。当我单击手风琴部分的链接时,网站将选项卡 2 切换为选项卡 1。我需要保留选项卡 2。我知道 cookie 不是解决此问题的方法。非常感谢您的回复!

下面是我写的代码:

    <!-- Inside the head tag of index.php -->
    $(function() {
  $( "#accordion" ).accordion({
    heightStyle: "content"
  });
});

    $(function() {
       $( "#tabs" ).tabs();
    });


    <!-- Inside the <body> tag of index.php -->
    <div id="tabs">
    <ul>
      <li><a href="#tabs-1">Home</a></li>
      <li><a href="#tabs-2">Products</a></li>
        </ul>
    <div class="tab" id="tabs-1">
      <h1>Content tab 1</h1>
    </div>
    <div class="tab" id="tabs-2">
    <!-- The tab contains a table (one row, two columns). First column contains the 
         accordion, the second column shows the content behind the Products list item.
     -->
    <table>
       <tr>
         <td width="300">
          <div id="accordion">
         <h3>Products</h3>
      <div>
         <ul>
        <li><a href="index.php?pag=x1#tabs-2">Type 1</a></li>
        <li><a href="index.php?pag=x2#tabs-2">Type 2</a></li>
         </ul>
      </div>
          </div>
         </td>
         <td> 
    <?php

        if(isset($_GET['pag'])){
                switch($_GET['pag']){
                    case 'x1':include("pages/X1.php");break;
                    case 'x2':include("pages/X2.php");break;
                    default: include("pages/ui.php");
                }
            }else include("pages/ui.php");                      
    ?>
        </td>
        </tr>
    </table>
    </div> 
    </div>     
4

0 回答 0