JavaScript DHTML/Mochkit/Sortable

Материал из Web эксперт
Перейти к: навигация, поиск

Sortable tree test

 
<!--
MochiKit is dual-licensed software.  It is available under the terms of the
MIT License, or the Academic Free License version 2.1.  The full text of
each license is included below.
-->
<!-- Code revised from MochiKit demo code -->
<!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" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Sortable tree test</title>
        <script type="text/javascript" src="MochiKit-1.4.2/lib/MochiKit/MochiKit.js"></script>
        <script type="text/javascript" src="MochiKit-1.4.2/lib/MochiKit/Position.js"></script>
        <script type="text/javascript" src="MochiKit-1.4.2/lib/MochiKit/Visual.js"></script>
        <script type="text/javascript" src="MochiKit-1.4.2/lib/MochiKit/Signal.js"></script>
        <script type="text/javascript" src="MochiKit-1.4.2/lib/MochiKit/DragAndDrop.js"></script>
        <script type="text/javascript" src="MochiKit-1.4.2/lib/MochiKit/Sortable.js"></script>
    <style type="text/css">
      ul  {padding-top:4px; padding-bottom: 2px; border: 1px solid #ccf;}
      li  {border: 1px solid #fcc;}
    </style>
  </head>
  <body>
    <a href="#" onclick="alert(MochiKit.Sortable.Sortable.serialize("menu"));return false">serialize 1</a>
    
    <ul id="menu" style="padding-top: 6px; padding-bottom: 6px;">
        <li class="edit_link level0" id="t1_7">
          System
          <ul class="edit_list">
          <li class="edit_link level1" id="t1_8">
            Page Not Found
            <ul class="edit_list"></ul>
          </li>
          <li class="edit_link level1" id="t1_9">
            Translation Not Available
            <ul class="edit_list"></ul>
          </li>
        </ul>
      </li>
        <li class="edit_link level0" id="t1_10">
        Main Menu
          <ul class="edit_list">
          <li class="edit_link level1" id="t1_1">
            Welcome
               <ul class="edit_list"></ul>
          </li>
          <li class="edit_link level1" id="t1_2">
            Software
            <ul class="edit_list">
              <li class="edit_link level2" id="t1_4">
                Serial Console
                <ul class="edit_list">
                  <li class="edit_link level3" id="t1_6">
                    Features
                    <ul class="edit_list"></ul>
                  </li>
                </ul>
              </li>
              <li class="edit_link level2" id="t1_5">
                Property Manager
                <ul class="edit_list"></ul>
              </li>
              <li class="edit_link level2" id="t1_11">
                Geomap
                <ul class="edit_list"></ul>
              </li>
            </ul>
          </li>
          <li class="edit_link level1" id="t1_12">
            Services
            <ul class="edit_list"></ul>
          </li>
          <li class="edit_link level1" id="t1_13">
            Software
            <ul class="edit_list">
              <li class="edit_link level2" id="t1_14">
                Serial Console
                <ul class="edit_list">
                  <li class="edit_link level3" id="t1_15">
                    Features
                    <ul class="edit_list"></ul>
                  </li>
                </ul>
              </li>
              <li class="edit_link level2" id="t1_16">
                Property Manager
                <ul class="edit_list"></ul>
              </li>
              <li class="edit_link level2" id="t1_17">
                Geomap
                <ul class="edit_list"></ul>
              </li>
            </ul>
          </li>
          <li class="edit_link level1" id="t1_18">
            Services
            <ul class="edit_list"></ul>
          </li>
        </ul>
      </li>
    </ul>
    <script type="text/javascript">
    
    MochiKit.Sortable.Sortable.create("menu", {tree:true,scroll:window});
    
    </script>
    
    <ul id="menu2" style="padding-top: 6px; padding-bottom: 6px;">
        <li class="edit_link level0" id="t2_7">
          System
          <ul class="edit_list">
          <li class="edit_link level1" id="t2_8">
            Page Not Found
            <ul class="edit_list"></ul>
          </li>
          <li class="edit_link level1" id="t2_9">
            Translation Not Available
            <ul class="edit_list"></ul>
          </li>
        </ul>
      </li>
        <li class="edit_link level0" id="t2_10">
        Main Menu
          <ul class="edit_list">
          <li class="edit_link level1" id="t2_1">
            Welcome
               <ul class="edit_list"></ul>
          </li>
          <li class="edit_link level1" id="t2_2">
            Software
            <ul class="edit_list">
              <li class="edit_link level2" id="t2_4">
                Serial Console
                <ul class="edit_list">
                  <li class="edit_link level3" id="t2_6">
                    Features
                    <ul class="edit_list"></ul>
                  </li>
                </ul>
              </li>
              <li class="edit_link level2" id="t2_5">
                Property Manager
                <ul class="edit_list"></ul>
              </li>
              <li class="edit_link level2" id="t2_11">
                Geomap
                <ul class="edit_list"></ul>
              </li>
            </ul>
          </li>
          <li class="edit_link level1" id="t2_12">
            Services
            <ul class="edit_list"></ul>
          </li>
          <li class="edit_link level1" id="t2_13">
            Software
            <ul class="edit_list">
              <li class="edit_link level2" id="t2_14">
                Serial Console
                <ul class="edit_list">
                  <li class="edit_link level3" id="t2_15">
                    Features
                    <ul class="edit_list"></ul>
                  </li>
                </ul>
              </li>
              <li class="edit_link level2" id="t2_16">
                Property Manager
                <ul class="edit_list"></ul>
              </li>
              <li class="edit_link level2" id="t2_17">
                Geomap
                <ul class="edit_list"></ul>
              </li>
            </ul>
          </li>
          <li class="edit_link level1" id="t2_18">
            Services
            <ul class="edit_list"></ul>
          </li>
        </ul>
      </li>
    </ul>
    
    <script type="text/javascript">
    
    MochiKit.Sortable.Sortable.create("menu2", {tree:true,scroll:window});
    
    </script>
  </body>
</html>