-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi!
I would like to add an onclick event to a image to do some tasks, but I don't know how to manage it.
Image component doesn't has any events , and A component is the same case.
I could use the Button component with the image inside, but it's design is not what I want to show to the user.
Is there any way to add a "onclick" event to a Image?
Thanks in advance,
Vicente
You missed one important thing on the Image component reference: "Inherited Supported Events: XulElement"
If you see the XulElement page, you'll find this: "Inherited Supported Events: HtmlBasedComponent".
Finally, on the HtmlBasedComponent page you'll find this list of supported events:
This means all components that extend HtmlBasedComponent or XulElement support those events. In practice this means all default ZK components.
Image extends XulElement, so it supports onClick, and you can listen to it normally. The same thing applies to the A component. If you decide to use an Image component, you might also want to add "cursor: pointer" style to help the user understand it can be clicked.
I have done alredy done this thing in my project you can below code working fine in my web application
<image src="/resource/image/greenbar-bar.gif" onClick="@command('doSomeAction')" />
Asked: 2013-04-29 09:35:42 +0800
Seen: 111 times
Last updated: Apr 29 '13