onClick for links

This commit is contained in:
Roland Gruber 2011-04-25 17:47:52 +00:00
parent 9dcbd06891
commit a82412004e
1 changed files with 16 additions and 1 deletions

View File

@ -1990,6 +1990,8 @@ class htmlLink extends htmlElement {
private $title = null;
/** target window */
private $targetWindow = null;
/** onClick event */
private $onClick = null;
/**
* Constructor.
@ -2028,7 +2030,11 @@ class htmlLink extends htmlElement {
if ($this->targetWindow != null) {
$targetWindow = ' target="' . $this->targetWindow . '"';
}
echo '<a href="' . $this->target . '"' . $title . $targetWindow . '>' . $image . $this->text . '</a>';
$onClick = '';
if ($this->onClick != null) {
$onClick = ' onclick="' . $this->onClick . '"';
}
echo '<a href="' . $this->target . '"' . $title . $targetWindow . $onClick . '>' . $image . $this->text . '</a>';
return array();
}
@ -2050,6 +2056,15 @@ class htmlLink extends htmlElement {
$this->targetWindow = htmlspecialchars($window);
}
/**
* Sets the onClick event.
*
* @param String $event JavaScript code
*/
public function setOnClick($event) {
$this->onClick = htmlspecialchars($event);
}
}
/**