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

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

Текущая версия на 08:24, 26 мая 2010

DOM node from border layout

<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("dijit.layout.BorderContainer");
            dojo.require("dijit.layout.ContentPane");
            dojo.require("dojo.parser");
            dojo.addOnLoad(function(  ) {
                var bc = new dijit.layout.BorderContainer(
                    {
                        design: "headline",
                        style: "height:500px;border:solid 3px"
                    },
                    "bc"
                );
                var topContentPane = new dijit.layout.ContentPane(
                    {
                        region: "top",
                        style: "background-color:#f21;height:100px;",
                        splitter: true,
                        minSize : 10,
                        maxSize : 100
                    },
                    document.createElement("div")
                );
                var centerContentPane = new dijit.layout.ContentPane(
                    {
                        region: "center"
                    },
                    document.createElement("div")
                );
                var bottomContentPane = new dijit.layout.ContentPane(
                    {
                        region: "bottom",
                        style: "height:100px;",
                        splitter: true
                    },
                    document.createElement("div")
                );
                bc.domNode.appendChild(topContentPane.domNode);
                bc.domNode.appendChild(centerContentPane.domNode);
                bc.domNode.appendChild(bottomContentPane.domNode);
                bc.startup();
            });
    </script>
  </head>
  <body class="tundra">
       <div id="bc"></div>
</body>
</html>


Five spots of BorderLayout

<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("dijit.layout.ContentPane");
            dojo.require("dijit.layout.BorderContainer");
            dojo.require("dojo.parser");
    </script>
  </head>
  <body class="tundra">
       <div dojoType="dijit.layout.BorderContainer"
          design="headline" style="height:500px;width:500px;border:solid 3px;">
            <div dojoType="dijit.layout.ContentPane" region="top"
              style="background-color:#f21;height:100px;" splitter="true"
                minSize=10 maxSize=100>top</div>
            <div dojoType="dijit.layout.ContentPane" region="center">center</div>
            <div dojoType="dijit.layout.ContentPane" region="bottom"
              style="height:100px;" splitter="true">bottom</div>
            <div dojoType="dijit.layout.ContentPane" region="left"
              style="width:100px;" splitter="true">left</div>
            <div dojoType="dijit.layout.ContentPane" region="right"
              style="width:100px;" splitter="true">right</div>
        </div>
</body>
</html>


Setup border container

<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("dijit.layout.ContentPane");
            dojo.require("dijit.layout.BorderContainer");
            dojo.require("dojo.parser");
    </script>
  </head>
  <body class="tundra">
        <div dojoType="dijit.layout.BorderContainer" design="headline"
             style="height:500px;width:500px;border:solid 3px;">
            <div dojoType="dijit.layout.ContentPane" region="top"
              style="background-color:#f21;height:100px;" splitter="true"
                 minSize=10 maxSize=100>top</div>
            <div dojoType="dijit.layout.ContentPane" region="center">center</div>
            <div dojoType="dijit.layout.ContentPane" region="bottom"
              style="height:100px;" splitter="true">bottom</div>
        </div>
</body>
</html>


Use code to border layout tags

<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("dijit.layout.BorderContainer");
            dojo.require("dijit.layout.ContentPane");
            dojo.require("dojo.parser");
            dojo.addOnLoad(function(  ) {
                var bc = new dijit.layout.BorderContainer(
                    {
                        design: "headline",
                        style: "height:500px;width:500px;border:solid 3px"
                    },
                    "bc"
                );
                var topContentPane = new dijit.layout.ContentPane(
                    {
                        region: "top",
                        style: "background-color:#f21;height:100px;",
                        splitter: true,
                        minSize : 10,
                        maxSize : 100
                    },
                    document.createElement("div")
                );
                var centerContentPane = new dijit.layout.ContentPane(
                    {
                        region: "center"
                    },
                    document.createElement("div")
                );
                var bottomContentPane = new dijit.layout.ContentPane(
                    {
                        region: "bottom",
                        style: "background-color:red;height:100px;",
                        splitter: true
                    },
                    document.createElement("div")
                );
                bc.startup();
                bc.addChild(topContentPane);
                bc.addChild(centerContentPane);
                bc.addChild(bottomContentPane);
            });
    </script>
  </head>
  <body class="tundra">
       <div id="bc"></div>
</body>
</html>