From a82412004e61170b9df9c85cbdde09fc94037049 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Mon, 25 Apr 2011 17:47:52 +0000 Subject: [PATCH] onClick for links --- lam/lib/html.inc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lam/lib/html.inc b/lam/lib/html.inc index c2969562..7cf2ddfe 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -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 '' . $image . $this->text . ''; + $onClick = ''; + if ($this->onClick != null) { + $onClick = ' onclick="' . $this->onClick . '"'; + } + echo '' . $image . $this->text . ''; 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); + } + } /**