随笔分类 -  javascript

摘要:http://www.ruanyifeng.com/blog/2010/05/object-oriented_javascript_encapsulation.html 阅读全文
posted @ 2013-03-31 23:04 mabel_on_line 阅读(124) 评论(0) 推荐(0) 编辑
摘要:http://www.cnblogs.com/Darren_code/archive/2012/01/31/questions.html 阅读全文
posted @ 2013-03-31 17:39 mabel_on_line 阅读(97) 评论(0) 推荐(0) 编辑
摘要:http://www.cnblogs.com/hongfei/archive/2011/11/29/2265377.html 阅读全文
posted @ 2013-03-31 15:51 mabel_on_line 阅读(681) 评论(0) 推荐(0) 编辑
摘要:http://xiaogai1010.blog.163.com/blog/static/137170308201211412647111/ 阅读全文
posted @ 2013-03-31 15:02 mabel_on_line 阅读(2094) 评论(0) 推荐(0) 编辑
摘要:http://www.blogjava.net/honeybee/articles/164008.html 阅读全文
posted @ 2013-03-31 14:53 mabel_on_line 阅读(113) 评论(0) 推荐(0) 编辑
摘要:在js逻辑运算中,0、""、null、false、undefined、NaN都会判为false,其他都为true 阅读全文
posted @ 2013-03-28 16:12 mabel_on_line 阅读(154) 评论(0) 推荐(0) 编辑
摘要:console.log( typeof 5);console.log(typeof !!5);log结果:numberboolean 看到很多代码if(!!attr),为什么不直接写if(attr);其实这是一种更严谨的写法:请测试 typeof 5和typeof !!5的区别。!!的作用是把一个其他类型的变量转成的bool类型。 阅读全文
posted @ 2013-03-28 16:11 mabel_on_line 阅读(799) 评论(0) 推荐(0) 编辑
摘要:http://jishuziyuan.com/archive/shaenxing2/6341238.html<script>if(1 == true){ console.log('1.ture');}else{ console.log('1.false'); }if(1===true){ console.log('2.true'); }else{ console.log('2.false'); }</script>log结果:1.ture 2.false实例http://hi.baidu.com/songz 阅读全文
posted @ 2013-03-28 15:56 mabel_on_line 阅读(292) 评论(0) 推荐(0) 编辑
摘要:touchTimeout&&clearTimeout(touchTimeout)等价于if(touchTimeout){clearTimeout(touchTimeout)} 阅读全文
posted @ 2013-03-28 15:46 mabel_on_line 阅读(257) 评论(0) 推荐(0) 编辑
摘要:<p>1111</p><p>2222</p><p>3333</p>点击每一个 p 标签之后 会显示该标签在整个数组中的index值,所可以实现的方法有多种,以下为常见的几种:一、window.onload = function(){ var pAry = document.getElementsByTagName("p"); for( var i=0; i<pAry.length; i++ ) { pAry[i].onclick = function(arg) { return function( 阅读全文
posted @ 2013-03-25 16:15 mabel_on_line 阅读(108) 评论(0) 推荐(0) 编辑
摘要:http://www.cnblogs.com/qiantuwuliang/archive/2010/01/12/1645302.html 阅读全文
posted @ 2013-03-25 15:43 mabel_on_line 阅读(110) 评论(0) 推荐(0) 编辑
摘要:http://www.jb51.net/article/24101.htm 阅读全文
posted @ 2013-03-25 15:42 mabel_on_line 阅读(115) 评论(0) 推荐(0) 编辑
摘要:var popularCity = {'北京市':['北京市'], '上海市':['上海市'], '广东省':['广州市','深圳市','惠州市'], '天津市':['天津市'], '湖北省':['武汉市'], '陕西省':['西安市\'], '四川省':['成都市'], '辽宁省':['大连市'],' 阅读全文
posted @ 2013-03-12 14:05 mabel_on_line 阅读(286) 评论(0) 推荐(0) 编辑
摘要:function showLockWarningUI(selection_id){ var element = $('#' + selection_id + ' .lock-warning-container'); element.show().find('.lock-warning-section').css('opacity','0').animate({top:'0px',opacity:'1'},500); setTimeout(function(){ hideLocking 阅读全文
posted @ 2013-02-28 14:07 mabel_on_line 阅读(3014) 评论(0) 推荐(0) 编辑
摘要:(function($){ var a = <?php echo ($keyword_lock)?1:0; ?>;$.log(a); })(jQuery); 阅读全文
posted @ 2013-02-26 17:29 mabel_on_line 阅读(195) 评论(0) 推荐(0) 编辑
摘要:一.之前的for (x = 0; x < 6; ++x) { setInterval((function(x){ return function() { $(boxItems[x]).fadeOut(3000,function() { itemPeopleInfoRender(people_infos, $(this)); }).fadeIn(3000); ... 阅读全文
posted @ 2013-02-25 13:55 mabel_on_line 阅读(224) 评论(0) 推荐(0) 编辑
摘要:Math.floor((Math.random()*10000))与(Math.floor(Math.random()*9+1))*1000的最大区别就是随机数范围的随机数个数相差很大,前者的范围更大。 阅读全文
posted @ 2013-02-20 16:45 mabel_on_line 阅读(2247) 评论(0) 推荐(0) 编辑
摘要:以下内容非原创,来自百度文库http://wenku.baidu.com/view/4796b6145f0e7cd18425368e.html通过它,你可以遍历对象、数组的属性值并进行处理。使用说明each函数根据参数的类型实现的效果不完全一致:1、遍历对象(有附加参数)$.each(Object, function(p1, p2) { this; //这里的this指向每次遍历中Object的当前属性值 p1; p2; //访问附加参数}, ['参数1', '参数2']);2、遍历数组(有附件参数)$.each(Array, function(p1, p2){ 阅读全文
posted @ 2013-02-19 16:12 mabel_on_line 阅读(183793) 评论(8) 推荐(15) 编辑
摘要:函数定义:function getStyleValue(text){ if (text){ return parseInt(text.replace(/px$/g, '')); }else{ return 0; } }函数调用:var a =getStyleValue(thisNOde.css('padding-top')); 阅读全文
posted @ 2013-02-17 14:02 mabel_on_line 阅读(292) 评论(0) 推荐(0) 编辑
摘要:显示:show() display:block;隐藏:hide() display:none;当显示和隐藏切换的时候,需要判断此刻是显示还是隐藏,那判断条件常用以下几种方法:1.if(thisNode.is(':hidden')){......}else{.......}2.首先给thisNode的Dom元素加class标识,例如改标识为class="showFlag",判断如下 if(thisNode.hasClass('showFlag')){.......}else{......} 同样的道理,也可以判断thisNode的其他内容,例如 阅读全文
posted @ 2013-02-17 11:04 mabel_on_line 阅读(12662) 评论(0) 推荐(0) 编辑