Advertisement
Guest User

Nalum

a guest
Jan 11th, 2010
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.36 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <script type="text/javascript" src="jquery.js"></script>
  5.         <script type="text/javascript">
  6.             //<![CDATA[
  7.                $(document).ready(function(){
  8.                    /** Show and hide the dropdown body when the link is clicked **/
  9.                    $('div#dropdownlink').click(function(){
  10.                        $('div#dropdownbody').toggle();
  11.                    });
  12.  
  13.                    /** Hide the dropdown body when an option is clicked and set a hidden form field to the selected value **/
  14.                    $('div#dropdownbody li').click(function(){
  15.                        $('#shape').val($(this).attr('title'));
  16.                        $('div#dropdownbody').toggle();
  17.                    });
  18.                });
  19.            //]]>
  20.         </script>
  21.         <style type="text/css">
  22.             .clear{clear: both;}
  23.             #dropdownlink {border: 1px solid #000;margin: 10px;padding: 5px;width: 150px;cursor: pointer;}
  24.             #dropdownbody {width: 250px;border: 1px solid #000;padding: 5px;margin: -11px 0 0 10px;display: none;}
  25.             #dropdownbody ul {list-style-type: none;margin: 0;padding: 0;}
  26.             #dropdownbody ul li {float: left;width: 40px;padding: 5px;margin: 0;text-align: center;}
  27.         </style>
  28.         <title>Dropdown Test</title>
  29.     </head>
  30.     <body>
  31.         <input type="hidden" name="shape" id="shape" value="" />
  32.         <div id="dropdownlink">Select Shape</div>
  33.         <div id="dropdownbody">
  34.             <ul>
  35.                 <li title="testing 1">sdf</li>
  36.                 <li title="testing 2">sdf</li>
  37.                 <li title="testing 3">sdf</li>
  38.                 <li title="testing 4">sdd</li>
  39.                 <li title="testing 5">sfd</li>
  40.                
  41.                 <li title="testing 6">sdf</li>
  42.                 <li title="testing 7">sdf</li>
  43.                 <li title="testing 8">sdf</li>
  44.                 <li title="testing 9">sdd</li>
  45.                 <li title="testing 10">sfd</li>
  46.                
  47.                 <li title="testing 11">sdf</li>
  48.                 <li title="testing 12">sdf</li>
  49.                 <li title="testing 13">sdf</li>
  50.                 <li title="testing 14">sdd</li>
  51.                 <li title="testing 15">sfd</li>
  52.             </ul>
  53.             <br class="clear" />
  54.         </div>
  55.     </body>
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement