一招解决!!!ECSHOP中transport.js和jquery的冲突
时间:2013-05-10 15:13来源:未知 作者:admin 点击: 次
在page_header.lbi文件的最后面添加下面的代码即可,经IETester测试后,ie6及以上都可行。
{insert_scripts files='niuzai/jquery-1.8.3.js'}
<script type="text/javascript">
$(function() {
window.__Object_toJSONString = Object.prototype.toJSONString;
delete Object.prototype.toJSONString;
});
</script>{insert_scripts files='test.js'}
test.js为自己用jquery写的一些代码,要放在jquery文件的后面,注意不能和jquery文件一同导入,注意顺序,否则会出错。顺序为:先导入transport.js文件{insert_scripts files='transport.js,utils.js'},然后导入jquery文件 ,{insert_scripts files='jquery-1.8.3.js'}
再加上这段代码
<script type="text/javascript">
$(function() {
window.__Object_toJSONString = Object.prototype.toJSONString;
delete Object.prototype.toJSONString;
});
</script>最后引入自己用jqeury书写的js文件。
{insert_scripts files='test.js'}
提示:一个简单的解决$冲突的方法
(function($){ //在这里面写你的JS代码, 可以放心使用$符号, 不会产生冲突})(jQuery);
