本文整理匯總了PHP中Button::addEvent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Button::addEvent方法的具體用法?PHP Button::addEvent怎麽用?PHP Button::addEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Button
的用法示例。
在下文中一共展示了Button::addEvent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: buildXHTML
/**
* Construct the widget
*
* @access private
*/
function buildXHTML()
{
$colorpicker = PIWI_URL . 'piwidata/js/colorpicker/ColorPicker2.js';
$popup = PIWI_URL . 'piwidata/js/colorpicker/PopupWindow.js';
$anchor = PIWI_URL . 'piwidata/js/colorpicker/AnchorPosition.js';
$this->addFile($colorpicker);
$this->addFile($popup);
$this->addFile($anchor);
$pickerName = $this->_id . '_colorpicker';
$this->_XHTML = "<script type=\"text/javascript\">\n";
$this->_XHTML .= "var " . $pickerName . "_properties = [];\n";
$this->_XHTML .= $pickerName . "_properties['windowname'] = '" . $this->_popupName . "';\n";
$this->_XHTML .= $pickerName . "_properties['fontStyle'] = '" . $this->_colorFontStyle . "';\n";
$this->_XHTML .= $pickerName . "_properties['fieldID'] = '" . $this->_entry->getID() . "';\n";
if (!empty($this->_onSelectEvent)) {
$this->_onSelectEvent = " " . $this->_onSelectEvent . " ";
}
$this->_XHTML .= $pickerName . "_properties['onselect'] = '" . $this->_onSelectEvent . "';\n";
if ($this->_usePopup) {
$this->_XHTML .= "var " . $pickerName . " = new ColorPicker('window'," . $pickerName . "_properties);\n";
} else {
$this->_XHTML .= "var " . $pickerName . " = new ColorPicker(''," . $pickerName . "_properties);\n";
}
$this->_XHTML .= "</script>\n";
$this->_button->addEvent(ON_CLICK, $pickerName . ".select(document.getElementById('" . $this->_entry->getID() . "'), " . "'" . $pickerName . "_ahref'); return false;");
if (!empty($this->_onSelectEvent)) {
$this->_entry->addEvent(ON_CHANGE, $this->_onSelectEvent);
}
if ($this->_hideInput) {
$this->_entry->setType("hidden");
}
$this->_XHTML .= "<table border=\"0\" style=\"border-spacing: 0px; padding: 0px; border: 0px;\">\n";
$this->_XHTML .= " <tr>\n";
$this->_XHTML .= " <td>\n";
$this->_XHTML .= "<script type=\"text/javascript\">\n";
$this->_XHTML .= "function ExecutePingBackOf" . $this->_entry->getID() . "() {\n";
$this->_XHTML .= " " . $this->_onSelectEvent . "\n";
$this->_XHTML .= "}\n";
$this->_XHTML .= "</script>\n";
$this->_XHTML .= $this->_entry->get();
$this->_XHTML .= " </td>\n";
$this->_XHTML .= " <td>\n";
$this->_XHTML .= "<a id=\"" . $pickerName . "_ahref\"></a>\n";
$this->_XHTML .= $this->_button->get();
$this->_XHTML .= "<script type=\"text/javascript\">\n";
$this->_XHTML .= $pickerName . ".writeDiv();\n";
$this->_XHTML .= "</script>\n";
$this->_XHTML .= " </td>\n";
$this->_XHTML .= " </tr>\n";
$this->_XHTML .= "</table>";
}
示例2: CheckButtons
$checkButtons = new CheckButtons('checkbuttons1', 'vertical');
$checkButtons->setTitle('Check Buttons');
$checkButtons->addOption('Foo', 'FOO');
$checkButtons->addOption('Bar', 'BAR');
$checkButtons->addOption('Waz', 'WAZ');
$vbox->packStart($checkButtons);
$radioButtons = new RadioButtons('radiobuttons1', 'vertical');
$radioButtons->setTitle('Radio Buttons');
$radioButtons->addOption('Foo', 'FOO');
$radioButtons->addOption('Bar', 'BAR');
$radioButtons->addOption('Waz', 'WAZ');
$vbox->packStart($radioButtons);
//$file = new FileEntry('archivo');
//$vbox->packStart($file);
$b = new Button('b1', 'Send', STOCK_CANCEL);
$b->addEvent(new JSEvent(ON_CLICK, 'this.form.submit()'));
$vbox->packStart($b);
$form = new Form($_SERVER['PHP_SELF'], 'post');
$form->add($vbox);
$form->show();
if (count($_POST) > 1) {
$data = array();
$i = 0;
foreach ($_POST as $k => $v) {
$data[$i]['name'] = $k;
if (is_array($v)) {
$data[$i]['value'] = implode('<br />', $v);
} else {
$data[$i]['value'] = $v;
}
$i++;