I have written a trivial app which works on Firefox but not on IE and others.  
I have the handling of buttons and signals confused.

So I have now tried this even simpler tester app. 
I have:  
###################################################################
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Mochikit Button Tester</title>
    
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
    
    <script src="js/MochiKit.js" type="text/javascript"></script>
    
  </head>
  <body>
    <div id="test">Test Here</div>
    <script>
      var handler = function(e){
         alert("in handler");
      }
      
      var but = BUTTON({'id':'testButton'},"Hit Me");
 // Version ONE 
      //connect('testButton','onclick',handler);
 // Version TWO 
      connect(but,'onclick',handler);
      swapDOM($('test'),but);      
    </script>
      
  </body>
</html>
###################################################################

Version ONE of the connect fails with: 
   src has no properties
   connect(null, "onclick", function(), undefined) 

Version TWO works. 

In the documentation on connect I see:- 

   connect(src, signal, dest[, func]):

   Connects a signal to a slot, and return a unique identifier that can be
    used to disconnect that signal.

   src is the object that has the signal. You may pass in a string, in which
    case, it is interpreted as an id for an HTML element.

What have I missed?

Also I read in the Docs: 

   Using Signal for DOM Events

   When using MochiKit.Signal, do not use the browser's native event API. That  
 
   means, no onclick="blah", no elem.addEventListener(...), and certainly no
   elem.attachEvent(...). 

but in the Mailing lists I see references (from Bob) to using onclick etc. 

In my original code I used the onclick="blah" and it worked beautifully - but 
only on Firefox.  So I am now trying to mend my ways. 

Please can someone point me as a simple example showing me the right (and 
wrong?) ways to connect handlers to form elements - that will work cross 
platform.

Ta,

Dave

-- 

Dave Whiteley
[EMAIL PROTECTED]
Phone +44 (0)113 343 2059
Faculty of Engineering
The University of Leeds. Leeds, LS2 9JT,  UK

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to