如何从我自己的服务器(apache)运行dojo ..?

时间:2011-07-08 06:39:58

标签: dojo

我已经下载了dojo构建,现在我有一个疑问,在下面的示例代码中,我使用“dojo.js.uncompressed.js”作为源文件的开头,是不是?我想在网页中显示一个按钮。哪一个是起始文件?在道场图书馆。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html dir="ltr">

    <head>
        <style type="text/css">
            body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
        </style>
        <script src="../dojo/lib/dojo/dojo.js.uncompressed.js"
        djConfig="parseOnLoad: true">
        </script>
        <script type="text/javascript">
            dojo.require("dijit.form.Button");

            dojo.addOnLoad(function() {
                // Create a button programmatically:
                var button = new dijit.form.Button({
                    label: "Click me!",
                    onClick: function() {
                        // Do something:
                        dojo.byId("result1").innerHTML += "Thank you! ";
                    }
                },
                "progButtonNode");

            });
        </script>
        <link rel="stylesheet" type="text/css" href="../dojo/lib/dijit/themes/claro/claro.css"  />
    </head>

    <body class=" claro ">
        <button id="progButtonNode" type="button">
        </button>
        <div id="result1">
        </div>
        <!-- NOTE: the following script tag is not intended for usage in real
        world!! it is part of the CodeGlass and you should just remove it when
        you use the code -->
        <script type="text/javascript">
            dojo.addOnLoad(function() {
                if (document.pub) {
                    document.pub();
                }
            });
        </script>
    </body>

</html>

1 个答案:

答案 0 :(得分:0)

应该将 dojo(和任何js文件)放在html文件旁边,以便服务器提供服务。那么你不必涉及长相对路径