JavaScript DHTML/Dojo toolkit/ComboButton — различия между версиями

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

Версия 09:59, 26 мая 2010

Add Icon to ComboButton MenuItem

 
<html>
  <head>
    <link rel="StyleSheet" type="text/css"
      href="js/dojo/dijit/themes/tundra/tundra.css">
    <script type="text/javascript">
      var djConfig = {
        baseScriptUri : "js/dojo/",
        parseOnLoad : true
      };
    </script>
    <script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
    <script>
        dojo.require("dojo.parser");
        dojo.require("dijit.form.Button");
        dojo.require("dijit.Menu");
        function save_function() {
           alert("Save");
        }
        function save_as_function(choice) {
           alert("Save As");
        }
    </script>
  </head>
  <body class="tundra">
    <div dojoType="dijit.form.ruboButton" onclick="save_function">
    <span>File</span>
        <div dojoType="dijit.Menu" id="saveMenu" toggle="fade" style="display: none;">
                <div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconSave" onclick="save_function">
                    Save
                </div>
                <div dojoType="dijit.MenuItem" onclick="save_as_function">
                    Save As
                </div>
        </div>
    </div>
  </body>
</html>



ComboButton click event

 
<html>
  <head>
    <link rel="StyleSheet" type="text/css"
      href="js/dojo/dijit/themes/tundra/tundra.css">
    <script type="text/javascript">
      var djConfig = {
        baseScriptUri : "js/dojo/",
        parseOnLoad : true
      };
    </script>
    <script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
    <script>
        dojo.require("dojo.parser");
        dojo.require("dijit.form.Button");
        dojo.require("dijit.Menu");
        function save_function() {
           alert("Save");
        }
        function save_as_function(choice) {
           alert("Save As");
        }
    </script>
  </head>
  <body class="tundra">
    <div dojoType="dijit.form.ruboButton" onclick="save_function">
    <span>File</span>
        <div dojoType="dijit.Menu" id="saveMenu" toggle="fade" style="display: none;">
                <div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconSave" onclick="save_function">
                    Save
                </div>
                <div dojoType="dijit.MenuItem" onclick="save_as_function">
                    Save As
                </div>
        </div>
    </div>
  </body>
</html>



ComboButton MenuItem click event

 
<html>
  <head>
    <link rel="StyleSheet" type="text/css"
      href="js/dojo/dijit/themes/tundra/tundra.css">
    <script type="text/javascript">
      var djConfig = {
        baseScriptUri : "js/dojo/",
        parseOnLoad : true
      };
    </script>
    <script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
    <script>
        dojo.require("dojo.parser");
        dojo.require("dijit.form.Button");
        dojo.require("dijit.Menu");
        function save_function() {
           alert("Save");
        }
        function save_as_function(choice) {
           alert("Save As");
        }
    </script>
  </head>
  <body class="tundra">
    <div dojoType="dijit.form.ruboButton" onclick="save_function">
    <span>File</span>
        <div dojoType="dijit.Menu" id="saveMenu" toggle="fade" style="display: none;">
                <div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconSave" onclick="save_function">
                    Save
                </div>
                <div dojoType="dijit.MenuItem" onclick="save_as_function">
                    Save As
                </div>
        </div>
    </div>
  </body>
</html>