试图使灯箱在我的服务器上工作,但出现了eseese 2错误
Uncaught TypeError: Object [object Object] has no method ‘attachEvent’ prototype.js:6490
Uncaught TypeError: Object [object Object] has no method ‘dispatchEvent’ prototype.js:6598
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="\Content\js\lightBox.js"></script>
<link rel="stylesheet" href="\Content\css\lightBox.css" type="text/css" media="screen">
解决方法:
您可以将jQuery绑定到您分配的变量上,以消除发生的所有冲突,正如alex在评论中所说的…例如,从jQuery website
// Line that tells jQuery to bind to "j" and not $
var j = jQuery.noConflict();
// Do something with jQuery
j( "div p" ).hide();
// Do something with another library's $()
$( "content" ).style.display = "none";