-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello Everyone,
Below is my code which is not working for IE 8 and IE 9 browsers
Div preButtonDiv = new Div();
String imgSrc = Sessions.getCurrent().getWebApp().getRealPath("images/slideshow/previous.png"); // this is the image source path
AImage preAImg = new AImage(imgSrc);
Image preImage = new Image();
preImage.setContent(preAImg);
preButtonDiv.appendChild(preImage);
preImage .setVisible(false);
preButtonDiv.addEventListener(Events.ON_MOUSE_OVER, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
preImage .setVisible(true);
}
});
In Above code "nextImage.setVisible(true);" This is not working .For Events.ON_MOUSE_OVER
"Events.ON_MOUSE_OVER " is not call in this case for IE8, IE 9 Browsers
Please Suggest
rishi
rishi,
When posting code here, please use the [code] [/code] block. It makes it easier for users of this forum to read. You can also click the # button just under the Preview tab when editing your post.
A couple of things:
1) I don't see (and maybe you just didn't include all the code) where preButtonDiv is ever attached to a parent component
(like a <window>)
2) You may need to have something actually in the preButtonDiv (like some text or at the very least a non-breaking space).
Otherwise, the event probably won't fire.
To illustrate, I modified your example slightly (used an existing image since I can't see your server and added some text in the div):
<zk> <zscript> import org.zkoss.zk.ui.util.GenericForwardComposer; public class myController extends GenericForwardComposer { Window win; public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); Div preButtonDiv = new Div(); Image preImage = new Image(); preImage.setSrc("http://www.zkoss.org/zksandbox/img/msn1.gif"); preButtonDiv.appendChild(new Label("mouse over here")); preButtonDiv.appendChild(preImage); win.appendChild(preButtonDiv); preImage.setVisible(false); preButtonDiv.addEventListener(Events.ON_MOUSE_OVER, new EventListener() { public void onEvent(Event event) throws Exception { preImage.setVisible(true); } }); } } </zscript> <window id="win" apply="myController"> </window> </zk>
Give the above a try in your environment and I think you'll see that it works (I tested in IE 9, Chrome, and FF 14).
Hope that helps,
Todd
Asked: 2012-07-31 16:37:03 +0800
Seen: 175 times
Last updated: Aug 06 '12