0

Area in Imagemap with href

asked 2007-05-23 14:36:18 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4326682

By: javacooperation

Hi,

we do have the following problem.

We have an image map and want to execute a link containing javascript as soon as the user clicks on the corresponding area of the image map (a behaviour similar to href in Button, which works fine): "javascript:document.jmol.script('select
10-100;')"

Ok, so what I did so far is that I implemented a new Component that extends org.zkoss.zul.Area and called it AreaHref. All it does is to overwrite the getOuterAttrs() method and to replace the part

final StringBuffer sb = new StringBuffer(64).append("
href=\"javascript:zkArea.onclick('").append(getUuid()).append("')\"");

by

final StringBuffer sb = new StringBuffer(64).append("
href=\"javascript:document.jmol.script('select 10-100;')\"");

Ok, that does not work...

Interestingly it works to open external links, i.e.

final StringBuffer sb = new StringBuffer(64).append("
href=\"http://www.google.de"");

opens google...

Any ideas how we could solve that or where I am wrong?

Thanks in advance

Fabian

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2007-05-24 06:45:19 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4327977

By: robbiecheng

Hi Fabian,

You could register an onClick event listener in the imagemap. If any area of this imagemap is clicked, an onClick event is send to the imagemap. You could declare an method to transfer this page, as follows.

<zk>
<imagemap src="/img/sun.jpg" onClick="go(event.area)">
<area id="a" tooltiptext="A" coords="60,123,220,330"/> <zscript><![CDATA[
void go(String areaid){
Executions.sendRedirect(areaid + ".zul");
}
]]>
</zscript>
</imagemap>
</zk>

You could test this at the demo site of zk.

/Robbie

link publish delete flag offensive edit

answered 2007-05-24 09:59:30 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4328236

By: javacooperation

Hi,

thanks for the answer, I'll try it as soon as possible...

Best regards,

Fabian

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2007-05-23 14:36:18 +0800

Seen: 633 times

Last updated: May 24 '07

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