随笔分类 -  AJAX

摘要:其中参数data为数组,其的格式为: 效果为: 阅读全文
posted @ 2016-10-01 16:28 sonicit 阅读(5205) 评论(1) 推荐(0)
摘要:注意,在seajs中使用require加载静态文件时,必须使用常量,不能用变量。如果一定要用变量,请使用require.async 阅读全文
posted @ 2016-06-22 15:48 sonicit 阅读(1243) 评论(0) 推荐(0)
摘要:关于bootstrapValidator的AJAX提交有几种方法:1、form中一定要放一个类型为submit的按钮,然后添加success.form.bv 事件,如下1 on('success.form.bv', function(e) {2 e.preventDefault();3 ... 阅读全文
posted @ 2015-11-21 10:35 sonicit 阅读(7235) 评论(0) 推荐(1)
摘要:最近项目中有很多JS,体积又大,想压缩一下。然后从万能的搜索引擎中找到了TBCompressor,很是不错,不过,这有个缺点,就是不能对目录中的JS/CSS文件进行压缩。没办法,自己整了一下。 说明:此版本是基于最新的TBCompressor 2.4.2修改而来,基本没做任何改动,支持在文件夹中点右键压缩,文件名命名规则和原来一样,压缩包中也有。另附批量改名BAT,把JS文件名后添加 .source.TBCompressor 2.4.2修改版 批量改名 阅读全文
posted @ 2011-12-26 13:29 sonicit 阅读(305) 评论(0) 推荐(0)
摘要:今天做项目时遇到很郁闷的事情,示例如下:var a = json; /*一个JSON对象*/当我对a操作后,json一起改变。这可不是我想要的。然后自己写了一个复制JSON对象的方法。1cloneJSON:function(para){2varrePara=null;3vartype=Object.prototype.toString.call(para);4if(type.indexOf("Object")>-1){5rePara=jQuery.extend(true,{},para);6}elseif(type.indexOf("Array") 阅读全文
posted @ 2011-11-27 14:08 sonicit 阅读(5603) 评论(0) 推荐(1)
摘要:HTML代码:<divclass="float"id="float">我是个腼腆羞涩的浮动层...</div>JS代码:var$smartFloat=function(elements){varposition=function(element){vartop=element.getPosition().y,pos=element.getStyle("position");window.addEvent("scroll",function(){varscrolls=this.getScrol 阅读全文
posted @ 2011-08-16 16:16 sonicit 阅读(380) 评论(0) 推荐(0)
摘要:HTML代码: <divclass="float"id="float">我是个腼腆羞涩的浮动层...</div>JS代码:$.fn.smartFloat=function(){varposition=function(element){vartop=element.position().top,pos=element.css("position");$(window).scroll(function(){varscrolls=$(this).scrollTop();if(scrolls>top){if(w 阅读全文
posted @ 2011-08-16 16:15 sonicit 阅读(668) 评论(0) 推荐(0)
摘要:本例是基于Prototype的数据分页,能对行数,列数进行设置,列和行都是用表格进行布局,需要时根据自己的喜好进行修改。 页面导航类: var TNavigationBar = new Class.create(); TNavigationBar.prototype = { initialize: function(_cssPath){ this.viewObj = nul... 阅读全文
posted @ 2008-03-09 10:42 sonicit 阅读(927) 评论(1) 推荐(0)