File: test_prototype.html

Recommend this page to a friend!
  Classes of Jo Giraerts  >  cjEvents  >  test_prototype.html  >  Download  
File: test_prototype.html
Role: Auxiliary data
Content type: text/plain
Description: Test prototype
Class: cjEvents
Handle browser events in PHP
Author: By
Last change:
Date: 11 years ago
Size: 2,110 bytes


Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <title>cjEvents - Test JQuery</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>cjEvents Test</title>
        <script type="text/javascript" src=""></script>
        <script type="text/javascript" src="json2.js"></script>
        <script type="text/javascript" src="events.js"></script>

        <script type="text/javascript">
            function callback1(event)
                var args = event.memo;

                $('event1answer').update('We received a jsevent ('+event.eventName+'). The arguments of the event are: '+args.join(', '));

            function callback2(event)
                var args = event.memo;

                $('event2answer').update('We received a jsevent ('+args[0]+'). The arguments of the event are: '+args.join(', '));

            // Binding the events to their callback
            document.observe("dom:loaded", function() {
                $(document.body).observe('phpevent:jsevent1', callback1);
                $(document.body).observe('phpevent:jsevent2', callback2);
                // listenForPHPEvents();
      <h1>cjEvents Prototype Test</h1>
          When clicking 1 of the buttons, you will raise an event that gets sent to PHP. We've set up PHP to receive those events and
          raise a <i>jsevent</i> again to answer for it. The <i>jsevent</i> will be captured by the javascript callbacks on this page,
          and you will see the answer appearing next to the button you clicked.

      <input type="button" value="Raise phpevent1" onclick="raisePHPEvent('phpevent1', 'arg1-1', 'arg1-2');" /> <span id="event1answer"></span><br/>
      <input type="button" value="Raise phpevent2" onclick="raisePHPEvent('phpevent2', 'arg2-1', 'arg2-2')" /> <span id="event2answer"></span>
For more information send a message to info at phpclasses dot org.