随笔分类 -  JS/CSS

[javascript] 对象拷贝
摘要:1 Object.prototype.clone = function() { 2 var copy = (this instanceof Array) ? [] : {}; 3 for (attr in this) { 4 if (!obj.hasOwnProperty(attr)) continue; 5 copy[attr] = (typeof this[i] == "object")?obj[attr].clone():obj[attr]; 6 } 7 return copy; 8 }; 9 10 11 a = {k1:1, k2:2, k3:3};... 阅读全文

posted @ 2013-12-11 16:00 bluefrog 阅读(249) 评论(0) 推荐(0)

[css] CSS3中的单位
摘要:FROM http://www.qianduan.net/understand-the-unit-of-length-in-the-css.htmlCSS3中的单位:css3中引入了一些新的单位:ch——字符0(零)的宽度;rem——根元素(html元素)的font-size;vw——viewpoint width,视窗宽度,1vw等于视窗宽度的1%;vh——viewpoint height,视窗高度,1vh等于视窗高度的1%;vmin——vw和vh中较小的那个。显然vw、vh、vmin是针对移动设备的,如果视窗大小变化了,这三个值也会跟着相应的变化。rem单位感觉就是px+em的变体,是否值 阅读全文

posted @ 2013-10-10 15:49 bluefrog 阅读(1565) 评论(0) 推荐(0)

[javascript] 判断 iframe 是否加载完成
摘要:fromhttp://www.planabc.net/2009/09/22/iframe_onload/ 1 var iframe = document.createElement("iframe"); 2 iframe.src = "http://www.planabc.net"; 3 4 if (iframe.attachEvent){ // for ie 5 iframe.attachEvent("onload", function(){ 6 alert("Local iframe is now loaded.&quo 阅读全文

posted @ 2013-09-11 10:55 bluefrog 阅读(442) 评论(0) 推荐(0)

[javascript] 邮箱&&电话正则
摘要:邮箱/^(?:[a-z\d]+[_\-\+\.]?)*[a-z\d]+@(?:([a-z\d]+\-?)*[a-z\d]+\.)+([a-z]{2,})+$/i;电话(兼容手机&分机号)/^[0][1-9]{2,3}-[0-9]{5,8}(-[0-9]{1,6})?$/.test(v) || /^([\+]?[0]?86)?[1][3,5][0-9]{9}$/.test(v) 阅读全文

posted @ 2012-07-26 16:51 bluefrog 阅读(580) 评论(0) 推荐(0)

[javascript]MooTools Selectors(MooTools 选择器)
摘要:工作有时会要写js 公司的产品用的是mootools框架,记下以后好找ELEMENT DOM选择//on are tag names.//All the divs on the page:$$('div');//All the divs and paragraphs//note: this returns an array with all the divs first,//then all the paragraphs:$$('div', 'p');//When you include Selectors.js, you can//pass i 阅读全文

posted @ 2012-04-19 18:09 bluefrog 阅读(6230) 评论(0) 推荐(0)