Login Register

[fixed]dojo.event has no properties

we'd better use Book 0.9 or 1.0 , not 0.4
in 1.0, there is no dojo.event.connect
it has changed into dojo.connect.
u can c the sample
http://hellokit.egloos.com/tb/1182135
====================================
dojo.event has no properties
initAjax()helloAjaxWorld.ht... (line 31)
toString()dojo.js (line 20)
toString()dojo.js (line 20)
toString()dojo.js (line 20)
toString(load )dojo.js (line 20)
[Break on this error] }
====================================================
I met this error following book0.4
I downloaded and use dojo 1.0.2 on Ubuntu, linux
There is no directory called "event" in the installed directory
So, using require dojo.event.* happens another error.

please understand that I am a newbie on DOJO toolkit.
let me know something to solve this problem.

Sincerely, kit

below is code

<head>
    <title>Hello Ajax World</title>
   
    <!-- SECTION 1 -->
            <style type="text/css">
                @import "dojoroot/dijit/themes/tundra/tundra.css";
                @import "dojoroot/dojo/resources/dojo.css"
            </style>
            
         <script type="text/javascript" src="dojoroot/dojo/dojo.js"
            djConfig="parseOnLoad: true">
</script>
   
        
           
        <script>
            function loadRemotely(e) {
                var kw = {
                    url:    "my_message.txt",
                    load:    function(type, data, evt) {
                                document.myForm.myBox.value = data;
                                dojo.byId("boxLoadTime").innerHTML = new Date();
                            },
                    method: "GET"
                };   
                dojo.io.bind(kw);
            }
       
            function initAjax() {
                dojo.event.connect(dojo.byId("loadIt"), "onclick", "loadRemotely");
            }
            dojo.addOnLoad(initAjax);
        </script>
       
  </head>
 
  <body class="tundra">
 
            Form loaded at:
            <script type="text/javascript">document.write(new Date());</script>
            
       
            <form name="myForm">
            <input type="button" id="loadIt" value="Click here to load value.">
            
       
            <input type="text" name="myBox" size="50" />
            Text loaded at: <span id="boxLoadTime">N/A</span>
            </form>
            
  </body>

give the 0.9+ book a look

Hey Kit,

The example you're looking at is for the (very) old version of Dojo. The method which was formerly located at dojo.event.connect() is now simply at dojo.connect. The new book should have updated examples:

http://dojotoolkit.org/book/dojo-book-0-9-0

And the porting guide can help you ferret out the differences should you have an older 0.4.x codebase:

http://www.dojotoolkit.org/book/dojo-porting-guide-0-4-x-0-9

Regards

--
Project Lead, The Dojo Toolkit
President, The Dojo Foundation