js部分:
;(function($){ //声明LightBox类构造函数 var LightBox = function(){ alert('msg'); }; LightBox.prototype = { }; Window["LightBox"] = LightBox; })(jQuery);
html部分:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <link rel="stylesheet" type="text/css" href="css/reset.css"> <link rel="stylesheet" type="text/css" href="css/lightbox.css"> </head><body> <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="js/lightbox.js"></script> <script type="text/javascript"> $(function(){ var LightBox = new LightBox(); }); </script></body></html>
正常应该alert弹出框吧,但控制台如下错误是为什么?
慕容森
相关分类