changeEventTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. require_once("../xajax.inc.php");
  3. function addEvent($sId,$sCode)
  4. {
  5. $objResponse = new xajaxResponse();
  6. $objResponse->addEvent($sId, "onclick", $sCode);
  7. return $objResponse->getXML();
  8. }
  9. $xajax = new xajax();
  10. //$xajax->debugOn();
  11. $xajax->registerFunction("addEvent");
  12. $xajax->processRequests();
  13. ?>
  14. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  15. "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
  16. <html xmlns="http://www.w3.org/1999/xhtml">
  17. <head>
  18. <title>Change Event Test | xajax Tests</title>
  19. <?php $xajax->printJavascript("../") ?>
  20. </head>
  21. <body>
  22. <h2><a href="index.php">xajax Tests</a></h2>
  23. <h1>Change Event Test </h1>
  24. <div id="myDiv"" style="padding: 3px; display: table; border: 1px outset black; font-size: large; margin-bottom: 10px;">Click Me</div>
  25. <form id="testForm1" onsubmit="return false;">
  26. <div><input type="submit" value="Set onclick to something" onclick="xajax_addEvent('myDiv','alert(\'Something\');'); return false;" /></div>
  27. <div><input type="submit" value="Set onclick to something else" onclick="xajax_addEvent('myDiv','alert(\'Something Else\');'); return false;" /></div>
  28. </form>
  29. <div id="submittedDiv"></div>
  30. </body>
  31. </html>