cshop中的jquery在ecshop中应用
更新时间:2016-10-09 点击量:1419
什么是jquery:
jquery是一个兼容多浏览器的javascript库,核心理念是write less,do more(写的少,做得更多)
最流行的javascript库。
如何在ecshop中使用jquery
if(Object.prototype.toJSONtuing){ var oldToJSONString = Object.toJSONString; Object.prototype.toSONString = function(){ if(arguments.length>0){ return false; }else{ return oldToJSONString.apply(this,arguments); } } } <script type="text/javascript" src="/js/jquery.min.js"></script> <script tupe="text/javascript"> jQuery.noConflict(); (function($){ $(function(){ //do }); })(jQuery); </script>
因为jQuery与ecshop的javascript中的transport.js文件冲突会造成一些报错,所以需要先下载一个jQuery.min.js文件引到ecshop的js文件里。
打开index.dwt通过
{insert_script files="jquery.min.js"} <script type="text/javascript"> (function($){ $(fumction(){ alert(343434) }); })(jQuery); </script>
这段代码引入。
**jQuery位置可以放在index的头部或者底部都可以**
如果文章对您有帮助,就打赏一个吧