简体   繁体   English

JSF2 ajax 标签在 Internet Explorer 中引发未知 javascript 错误

[英]JSF2 ajax tag throws unknown javascript error in Internet Explorer

Having this lines of code:有这行代码:

<h:commandLink value="Reset Filter" styleClass="button">
  <f:ajax event="click" render="filterWindowDiv tableX" listener="#{beanX.reset}" />
</h:commandLink>

and as well as with:以及:

<h:commandLink value="Reset Filter" styleClass="button">
  <f:ajax event="click" render="@all" listener="#{beanX.reset}" />
</h:commandLink>

an unknown error will be thrown in Internet Explorer 8: Internet Explorer 8 中将引发未知错误:

Object doesn't support this property or method         pageX.jsf, line1 character 7

The h:commandLink is within a o:window (OpenFaces 3). h:commandLinko:window (OpenFaces 3) 内。

However, I do get the same error if I am using the same lines of code for example for a Delete button which shows after invoking a bean method a o:popupLayer .但是,如果我使用相同的代码行,例如在调用 bean 方法 a o:popupLayer后显示的 Delete 按钮,我会得到相同的错误。

Any ideas?有任何想法吗? Thank you in advance!先感谢您!


I've had JavaScript code within my div which must be rendered adhoc while re-render a part of the page.我的 div 中有 JavaScript 代码,必须在重新渲染页面的一部分时临时渲染。 However, it seems IE cannot handle that issue while FF don't mind.但是,似乎 IE 无法处理该问题,而 FF 不介意。 I think to remember I've read something something about this.我想记住我读过一些关于这个的东西。 Anyway, since I've removed the JavaScript error is gone.无论如何,既然我已经删除了 JavaScript 错误就消失了。

But how to invoke my JavaScript code after rendering ?但是如何在渲染后调用我的 JavaScript 代码? I've solved it like this example:我已经像这个例子一样解决了它:

<h:commandLink value="Reset Filter" styleClass="button">
  <f:ajax event="click" render="@all" listener="#{beanX.reset}" 
          onevent="callback" />
</h:commandLink>

Callback method:回调方法:

function callback(data) {
  data.status == "success") {
    // your JavaScript code
  }
}

Thanks again for all your help!再次感谢你的帮助!

The problem here lies with click event of <h:commandLink>这里的问题在于<h:commandLink>的点击事件

Don't know the possible cause, but using mousedown will hopefully solve your problem.不知道可能的原因,但使用mousedown有望解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM