DWR util.js 在 Internet Explorer 中无法工作
我在我的项目中使用 DWR 已有几个月了。我尝试在我的一个jsp中使用dwr的util.js,但奇怪的是,当我包含util.js(版本2.0.1)时,没有其他javascript在Internet Explorer中工作(在mozilla中工作正常)。
我正在尝试使用 util.js 操作表格,如此处所述,更令人惊讶的是我什至看不到该链接在 Internet Explorer 中运行良好。
有没有人遇到过这个。有什么帮助吗?
谢谢!
I have been using DWR for couple of months in my project. i tried using dwr's util.js in one of my jsp but strangely when i include util.js(version 2.0.1) none other javascript is working in internet explorer(working fine in mozilla) .
i am trying to manipulate tables with util.js as described here and more surprisingly i can't even see the link functioning well in Internet Explorer.
has anyone come across this. any help?
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否也使用 jQuery、Prototype 或其他使用 $ 函数的 JavaScript 语言?
2.x 版本的 DWR Alias
dwr.util.byId
为“$
”(已弃用,因为它不如强大/有用) $
在 jQuery、Prototype 或类似的版本中)。他们试图变得聪明,并且仅在未预先定义
$
的情况下才使用别名,但检查逻辑存在缺陷。我猜想一开始他们是这样做的:
但后来有人意识到,如果没有定义
$
,这会抛出一个错误,所以它被提交为:这在 Firefox 中工作正常,因为这没有声明
$
的值,只是它存在。但在 Internet Explorer 中,var 语句将
$
重新定义为(无)...因此,当运行 if() 测试时它不存在...检查 3.x (RC )代码,他们为了更稳定而放弃了这个测试:
在 Firefox 和 Internet Explorer(以及据我所知所有其他浏览器)中工作正常...只需更新
中的
。util.js
文件dwr.jar我还应该注意:包含库的顺序将决定哪个库获得
$
函数的所有权。例如,要让 jQuery 拥有它,请执行以下操作:
要让 DWR 拥有它,请务必为 jQuery
文档设置 noConflict 标志: jQuery.noConflict
By any chance are you also using jQuery, Prototype, or another JavaScript language that uses the $ function?
The 2.x versions of DWR Alias
dwr.util.byId
as "$
" (which is deprecated, since it isn't as powerful/helpful as the$
in jQuery, Prototype or similar).They tried to be clever, and only do the Alias, if
$
wasn't pre-defined, but the check logic is flawed.I presume at first they did this:
but then someone realized that if
$
wasn't defined, this would throw an error, so it was commited as:which works fine in Firefox as this doesn't declare a value for
$
, just that it exists.But in Internet Explorer, the var statement re-defines
$
as (nothing)... thus it doesn't exist when the if() test is run...Checking the 3.x (RC) code, they ditched this test for the more stable:
Which works fine in Firefox AND Internet Explorer (& AFAIK all other browsers)... just update the
util.js
file in yourdwr.jar
.I should also note: the order in which you include libraries will determine which one gets ownership of the
$
function.e.g. to let jQuery have it, do:
to let DWR have it, be sure to set the noConflict flag for jQuery
Docs: jQuery.noConflict