/** * Adds an event * * The difference between this AddEvent and the * one in Bin:: is that it support jscalendar events ;-) */ function addEvent($event) { if (is_string($event) && func_num_args() == 2) { $action = func_get_arg(1); if (is_array($this->_availableEvents) && count($this->_availableEvents) > 0) { if (in_array($event, $this->_availableEvents)) { switch ($event) { case ON_CHANGE: $this->_entry->AddEvent(ON_CHANGE, $action); break; case ON_UPDATE: $this->_onUpdateEvent = $action; break; case ON_CLOSE: $this->_onCloseEvent = $action; break; case ON_SELECT: $this->_onSelectEvent = $action; break; } } else { die('[PIWI] - Sorry but you are not permitted to use ' . $event . ' in this widget'); } } else { $this->_Events[] = new JSEvent($event, $action); } } elseif (is_object($event) && strtolower(get_class($event)) == 'jsevent') { if (is_array($this->_availableEvents) && count($this->_availableEvents) > 0) { if (in_array($event->getID(), $this->_availableEvents)) { $id = $event->getID(); switch ($id) { case ON_UPDATE: $this->_onUpdateEvent = $event->getCode(); break; case ON_CLOSE: $this->_onCloseEvent = $event->getCode(); break; case ON_SELECT: $this->_onSelectEvent = $event->getCode(); break; } } else { die('[PIWI] - Sorry but you are not permitted to use ' . $event->getID() . ' in this widget'); } } } else { die('[PIWI] - Events should be objects'); } }
<meta name="Keywords" content="XML,tutorial,HTML,DHTML,CSS,XSL,XHTML,JavaScript,ASP,ADO,VBScript,DOM,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,W3C,Cascading Style Sheets,Active Server Pages,Dynamic HTML,Internet,database,development,Webbuilder,Sitebuilder,Webmaster,HTMLGuide,SiteExpert,iis" /> <meta name="Description" content="HTML,CSS,JavaScript,DHTML,XML,XHTML,ASP,ADO and VBScript tutorial from W3Schools." /> <meta http-equiv="pragma" content="no-cache" /> <meta http-equiv="cache-control" content="no-cache" /> <link rel="stylesheet" href="piwidata/css/default.css" type="text/css" /> </head> <body> <?php include_once "Piwi.php"; $button = new Button("boton", "Boton"); $button->SetSubmit(); $button->SetStock(STOCK_CANCEL); $button->AddEvent(new JSEvent(ON_CLICK, "javascript:alert('huevudisimo');")); //$button->Show (); $entry = new Entry("cajita", "Una cosa"); $entry->AddEvent(new JSEvent(ON_CHANGE, "javascript:alert(this.value)")); $entry->AddEvent(new JSEvent(ON_CHANGE, "javascript:alert(calcMD5(this.value));", "http://jaws.com.mx/templates/controlpanel/md5.js")); //$entry->Show (); $combo = new Combo("opciones"); $combo->AddOption("Jaws Proyect", "jawsproject"); $combo->AddOption("Piwi Proyect", "piwiproject"); $combo->AddOption("mBloggy", "mbloggy"); $combo->SetDefault("mbloggy"); //$combo->Show (); $combogroup = new ComboGroup("opciones2"); $pares = array(); $impares = array(); for ($i = 0; $i < 20; $i++) { if ($i % 2 == 0) { $pares[] = new ComboOption("numero {$i}", "N�mero {$i}"); } else {