05 2011 档案
摘要: 清除浮动是连续浮动元素之后的必备工作,在工作中我做到需要清除浮动的地方都要清除。比如,我在瑞星的项目中一直这样使用:.clear:after{content:'\0020';display:block;height:0;clear:both}.clear{*zoom:1}观察腾讯微博项目,并不是每个浮动必须清除,但是如果内部元素连续浮动,其外部元素必然定高以避免找不到高度的情况,其清除浮动的代码如下:.clear:after{content:'.';clear:both;display:block;height:0;visibility:hidden;line-阅读全文
摘要: 这是一份很全的css的重置样式表,来自meyerweb.com。/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 License: none (public domain)*/html, body, div, span, applet, object, iframe,h1, h2, h3, h4, h5, h6, p, blockquote, pre,a, abbr, acronym, address, big, cite, code,del, dfn, em, img, ins, kbd, q, s, samp,smal阅读全文
摘要: 工作繁忙,手指在键盘上翻飞,闪出时间把刚写的截字符串的代码粘贴过来,这是太常用的方法了$(function(){ $('.fn_sliceStr').each(function(){ var len = parseFloat($(this).attr('name')); var str = $(this).text(); if(str.length > len){ $(this).text(str.slice(0,len) + '...'); } });});阅读全文
摘要: //创建对象var o1 = new Object();o1.property1 = '1';o1.property2 = '2';//工厂模式function createObject(property1,property2){ var o = new Object(); o.property1 = property1; o.property2 = property2; return o; }var o1 = createObject('1','2');//构造函数模式(构造函数首字母大写)function O(property阅读全文
摘要: function load(minnum,maxnum){ var choice = maxnum - minnum + 1; var a = Math.floor(Math.random()*choice + minnum); return a; }var groups = ['0','1','2','3','4'];var b = groups[load(0,groups.length - 1)];alert(b);阅读全文
