i want an image icon in my vf page ,and when i click it certain javascript should be invoked.

i could add an image and invoke javascript but it does not look like clickable .Handpointer tool doesn't appear.i added an apex: out panel,specified an image and put an action support event for invoking javascript.It works as well.

But how to make hand tool appear?

  • 3
    Add style="cursor:pointer;" to your panel. – Sergej Utko Nov 21 '13 at 17:31

You can wrap the image in an anchor element, and the hand cursor will appear normally. You can also use a button to cause the hand cursor to appear.


<a href="#" onclick="doSomething()"><img src="some-url"/></a>

<apex:outputLink action="{!doSomething}"><apex:image url="some-url"/></apex:outputLink>

<apex:outputLink onclick="doSomething()"><apex:image url="some-url"/></apex:outputLink>

<button onclick="doSomething()"><img src="some-url"/></button>
  • FYI: You can eliminate the border with CSS. – Mike Chale Nov 21 '13 at 19:28
  • That is true, but it simply takes extra effort than using a normal link with a button. – sfdcfox Nov 21 '13 at 19:30

Add style="cursor:pointer;" to your panel. – mast0r

answers the questions :)

Not the answer you're looking for? Browse other questions tagged or ask your own question.