0

Image onclick event

asked 2013-04-29 09:35:42 +0800

cocoes gravatar image cocoes flag of Spain
94 6

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

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-04-29 09:54:08 +0800

gekkio gravatar image gekkio flag of Finland
899 1
http://gekkio.fi/blog

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:

  • onDrop
  • onClick
  • onDoubleClick
  • onRightClick
  • onMouseOver
  • onMouseOut
  • onOK
  • onCancel
  • onCtrlKey

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.

link publish delete flag offensive edit

Comments

You're right. I need an extra coffee on Mondays :-(

cocoes ( 2013-04-29 10:30:03 +0800 )edit
0

answered 2013-04-29 09:48:03 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

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')" />
link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2013-04-29 09:35:42 +0800

Seen: 111 times

Last updated: Apr 29 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More