0

I am trying to set up a webpage that has different menu selections and when a menu item is selected text is displayed in a separate section (depending on what text has been selected).

这是一个网页链接,说明了我想要实现的目标。

https://www.facebook.com/nrmainsurance/app_282857945119270

这是我作为尝试提出的代码,我对更简单的方法持开放态度。我还查看了 jquery、ajax、if else 代码、onlick 事件监听器(但没有完全掌握它们)。

我愿意接受建议。

    <!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>
</head>
<body>
<table width="80%" cellspacing="0" cellpadding="0" align="center">
   <tr>
       <td>
           <div align="center">
              <a href="#Step1" class="menuNav">
                  <strong>Step 1</strong>
              </a>
           </div>
        </td>
        <td>
           <div align="center">
              <a href="#Step2" class="menuNav">
                  <strong>Step 2</strong>
              </a>
           </div>
         </td>
         <td>
           <div align="center">
              <a href="#Step3" class="menuNav">
                  <strong>Step 3</strong>
              </a>
           </div>
         </td>
       </tr>
    </table>
<object type="text/html" width="80" height="150" border="thin">
       <?php
         if( onClick "#Step1" ) {
            echo (i hope this work ) ?>
        <?php

         } else { }
       ?>
    </object> 
</object> 
</body>
</html>
4

3 回答 3

2

我认为您正在尝试创建选项卡菜单。为此,您可以使用 jQuery Ui 选项卡。这是一个基本的演示http://jqueryui.com/tabs/。如果您想做一些样式,请查看此链接http://keith-wood.name/uiTabs.html

于 2013-02-22T05:19:43.977 回答
1

您可以使用 Jquery 来实现此效果。也真的很容易!我想这就是你要找的。

<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>jQuery UI Tabs - Default functionality</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <script>
  $(function() {
    $( "#tabs" ).tabs();
  });
  </script>
</head>
<body>

<div id="tabs">
  <ul>
    <li><a href="#tabs-1">Nunc tincidunt</a></li>
    <li><a href="#tabs-2">Proin dolor</a></li>
    <li><a href="#tabs-3">Aenean lacinia</a></li>
  </ul>
  <div id="tabs-1">
    <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
  </div>
  <div id="tabs-2">
    <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
  </div>
  <div id="tabs-3">
    <p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>
    <p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
  </div>
</div>


</body>
</html>

来源:http: //jqueryui.com/tabs/

于 2013-02-22T05:19:47.787 回答
0

PHP 没有“onclick”功能。它在 javascript 上。

您可以在http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm找到工作脚本,只需更改 css 的样式即可获得所需的设计。

于 2013-02-22T05:23:35.080 回答