未捕获的类型错误:对象#<对象>没有方法“dispatchEvent”;对象>
我正在尝试将 Drupal 与 Picasa Web 集成器 结合起来。
我的 page.tpl.php 部分中有这 3 行:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="/fotos/js/jquery.slimbox2/jquery.slimbox2.js" language="JavaScript"></script>
<script type="text/javascript" src="/fotos/js/jquery.pwi.js" language="JavaScript"></script>
我还将此脚本添加到我的 head 部分,以测试专辑(用户名和专辑名称并不重要,我使用我的用户名和专辑离线测试它,并且工作正常):
<script type="text/javascript">
$(document).ready(function() {
$("#container").pwi({
username: 'My',
maxresults: 5,
mode: 'album',
album: 'MyAlbum'
});
});
</script>
当我在 Drupal 页面上尝试时,Google Chrome 给我这个错误:
prototype.js:5733Uncaught TypeError: Object#<Object> has no method 'dispatchEvent'
I'm trying to combine Drupal with Picasa web integrator.
I have these 3 lines in the section of my page.tpl.php:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="/fotos/js/jquery.slimbox2/jquery.slimbox2.js" language="JavaScript"></script>
<script type="text/javascript" src="/fotos/js/jquery.pwi.js" language="JavaScript"></script>
I also added this script to my head section, to test an album (the username and albumname are not important, I tested it offline with my username and album and that worked fine):
<script type="text/javascript">
$(document).ready(function() {
$("#container").pwi({
username: 'My',
maxresults: 5,
mode: 'album',
album: 'MyAlbum'
});
});
</script>
Google Chrome gives me this error when I try it on my Drupal-page:
prototype.js:5733Uncaught TypeError: Object#<Object> has no method 'dispatchEvent'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Drupal 还附带了 jQuery,您不能简单地在
标记中添加更高版本。您可以尝试使用 Drupal 的 jquery 更新 来获取更新的版本,或者尝试 noConflict (我怀疑如果您想使用 Prototype,无论如何您都会需要它)。
Drupal also comes with jQuery, and you cannot simply just add the later version in
<script>
tags. You can try using Drupal's jquery update to get a more recent version, or try noConflict (I suspect you will need it anyhow if you want to use Prototype).看起来您还在页面上加载 prototype.js (由
lightbox.js,也许?,并且 jQuery 和 Prototype 使用的
$
可能是冲突的,如果您确实需要同时使用 Prototype 和 jQuery,请考虑使用 jQuery 的noConflict
。模式: http://api.jquery.com/jQuery.noConflict/。It looks like you are also loading prototype.js on the page (used by
lightbox.js
, perhaps?, and that perhaps the$
used by both jQuery and Prototype are conflicting. If you really need to use both Prototype and jQuery, look into using jQuery'snoConflict
mode: http://api.jquery.com/jQuery.noConflict/.