[Dojo-interest] Re: Dojo-interest Digest, Vol 16, Issue 103

Runsun Pan runsun at gmail.com
Tue Apr 18 20:36:04 MDT 2006


I was following the tutorial on the following page:

http://dojo.jot.com/WikiHome/Tutorials/HelloWorld#Introduction

I inserted a line:

    alert(dojo)

to show that the module dojo was indeed loaded successfully.
The resulted html page shows a button that shows no reaction when clicked.
It seems to me that the line:

    dojo.event.connect

doesn't work at all. The line:

    helloButton = dojo.widget.byId('helloButton')

was shown not working either ( alert(helloButton) returns 'undefined')

Can someone tell what's going wrong ?



CODE ATTACHED:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript"
        src='file:///E:\prog\html\js\download\dojo\tutorials\HelloWorld\js\dojo\dojo.js'></script>

    <!-- SECTION 3 -->
    <script type="text/javascript">
      alert(dojo)
      dojo.require("dojo.event.*");
      dojo.require("dojo.widget.*");
      dojo.require("dojo.widget.Button2");

      function helloPressed()
      {
        alert('You pressed the button');
      }

      function init()
      {
        var helloButton = dojo.widget.byId('helloButton');
        dojo.event.connect(helloButton, 'onClick', 'helloPressed')
      }
      dojo.addOnLoad(init);
    </script>

</head>
<body>
<button dojoType="Button2" id="helloButton">Hello World!</button>
</body>
</html>


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Runsun Pan, PhD
Nat'l Center for Macromolecular Imaging
Baylor College of Medicine, Houston, TX, USA
[Office] 713-798-6989 [Fax] 775-659-8969
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


More information about the Dojo-interest mailing list