随笔分类 - javascript精典案例集锦
摘要:1、http://www.ruanyifeng.com/blog/2012/11/require_js.html?bsh_bid=230697246 (require.js的用法) 2、http://blog.sae.sina.com.cn/archives/4382 (require.js 简洁入
阅读全文
摘要:1、https://www.zhihu.com/question/20351507 (AMD 和 CMD 的区别有哪些) 区别: 1. 对于依赖的模块,AMD 是提前执行,CMD 是延迟执行。不过 RequireJS 从 2.0 开始,也改成可以延迟执行(根据写法不同,处理方式不同)。CMD 推崇
阅读全文
摘要:a() && b() :如果执行a()后返回true,则执行b()并返回b的值;如果执行a()后返回false,则整个表达式返回a()的值,b()不执行; a() || b() :如果执行a()后返回true,则整个表达式返回a()的值,b()不执行;如果执行a()后返回false,则执行b()并返
阅读全文
摘要:1、 parse用于从一个字符串中解析出json对象,如var str = '{"name":"huangxiaojian","age":"23"}'结果:JSON.parse(str)Objectage: "23"name: "huangxiaojian"__proto__: Object 注意:
阅读全文
摘要:http://www.cnblogs.com/hqbhonker/p/5092300.html
阅读全文
摘要:git reset 046bd7b5c1d134b8123f59ea71b19875a6a2fc3e git reset --hard 046bd7b5c1d134b8123f59ea71b19875a6a2fc3e
阅读全文
摘要:scroll : function(){ $(window).scroll(function () { var scrollTop = $(this).scrollTop(); var scrollHeight = $(document).height(); var windowHeight = $
阅读全文
摘要:var discountOnline = !{discountOnline} if (discountOnline) { _fresh() setInterval(_fresh, 1000); } var nowtime = false; function _fresh() { var endtim
阅读全文
摘要:判断字符中是否包含有特殊字符: function containSpecial( s ) { var containSpecial = RegExp(/[(\ )(\~)(\!)(\@)(\#)(\$)(\%)(\^)(\&)(\*)(\()(\))(\-)(\_)(\+)(\=)(\[)(\])(
阅读全文
摘要:var Base = require( "../common/base" ) , HandlerBase = require( "../common/handlerBase" ) , Index; Index = Base.extend( function(){} , { extend : Hand
阅读全文
摘要:attachEvent方法可以动态的为网页内的元素添加一个事件.通常你想为某个按扭添加一个单击事件时.你都会在按扭内写上onclick=事件名称.使用attachEvent则不必这样做.你把写好的事件准备好,在需要的时候给元素绑定上再执行.而且attachEvent支持为某个元素绑定多个事件.执行顺
阅读全文
摘要:var str = "2016年4月11日";str= str.replace(/[\u5e74|\u6708]/g,"-").replace(/\u65e5/g,"");
阅读全文
摘要:var a = ["2013-01","2013-01","2013-02","2013-02","2013-02","2013-03","2013-03"]; Array.prototype.del = function() { var a = {}, c = [], l = this.lengt
阅读全文
摘要:function aa1511() { var chengshi="马鞍山"; var shengfen="安徽省"; return shengfen+"@"+chengshi; } function xialachaxun() { var hanshu=aa1511().split("@"); a
阅读全文
摘要:function confirmVdo(){ var videoVal = $(".video_src").val(); if(videoVal){ videoVal = videoVal.replace(/[\r\n]/g,""); videoVal = encodeURIComponent(vi
阅读全文
摘要:var event = window.event || arguments.callee.caller.arguments[0]; // 获取event对象 event = event.srcElement || event.target; var obj = event.srcElement ?
阅读全文
摘要:$(this).append('<a href="2-1partner.html"><div><img width="645" height="500" src=\''+animate_img[i]+'\' /></div></a>');
阅读全文
摘要:<html> <head> <title>Javascript模糊查找</title> </head> <body> <li onload="load('Name')" id="name">Name</li> <li onload="load('sex')" id="sex">sex</li> <l
阅读全文
摘要:var Page = function(cid, data,callback) { var _self = this; var cid = $(cid); var currPage=1; // 下拉上拉加载数据 var myScroll, pullDownEl, pullDownOffset, pu
阅读全文
浙公网安备 33010602011771号