自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 收藏
  • 关注

转载 Object.defineproperty实现数据和视图的联动

Object.defineproperty语法 在一个对象上定义新的属性 var o = {}; // 创建一个新对象 // Example of an object property added with defineProperty with a data property descriptor Object.defineProperty(o, "a", {value :...

2014-08-26 23:18:00 108

转载 css3动画-animation

animation驱使一组css style变化到另外一组css style,它可以定义keyframes的集合,指定style的开始和结束状态,它是transition的增强。 配置animation animation-delay:从加载到开始执行的延迟 animation-direction:normal|reverse|alternate|alternate-reverse...

2014-07-28 23:29:00 98

转载 css3动画-transition

当css属性改变的时候,控制animation的速度,让属性的变化发生在一段时间之内,而不是立即生效。 语法 transition: <property> <duration> <timing-function> <delay>; property:css属性的name,支持的属性列表 duration:持续时间 ti...

2014-07-27 13:18:00 99

转载 jquery判断对象的type

利用Object.toString.call()方法 看代码 先初始化class2type,将每种对象的toString后的值和type建立对应关系 core_toString.call([])输出"[Object Array]" class2type = {} core_toString = class2type.toString // Populate the cla...

2013-07-10 23:46:00 123

转载 向当前style sheet中插入一个新的style

很少会插入一个新的style rule,今天为了临时解决页面样式问题,需要更新很多页面的一些样式,这些页面都引用了一个公共的js,为了方便,直接在这个公共的js里面向style sheet插入新的style rule。 先看代码: /** * Add a stylesheet rule to the document (may be better pract...

2013-03-31 22:11:00 154

转载 javascript 工厂模式

1 简单工厂模式 var CarFactory = function(){}; CarFactory.prototype= { createCar: function(type){ varcar= null; switch(type){ case 'ford': car= new Ford();break; ...

2013-02-03 13:15:00 99

转载 javascript的单例模式

单例模式(Singleton),整个运行期间只会被初始化一次。该模式简单易懂,运用也很广泛。可以用它来聚合公共的方法,形成一个工具类,对外提供api。 1. 单例模式的基本结构 var Singleton = { attr1: 'test1', attr2: 10, method: function(){ ...

2013-01-27 11:19:00 91

转载 javascript实现ie6兼容position:fixed

positon:fixed 让HTML元素脱离文档流固定在浏览器的某个位置 网页中经常会有浮动的导航条会用到这种定位模式,但是ie6下并不兼容这种定位 浮动导航条的样式,重要的是position:fixed;bottom:60px;(浮动导航底部距离窗口底部60px) .floating_9677{position:fixed; z-index:961; bottom:60px;}...

2012-12-08 23:52:00 144

转载 javascript的浮点数计算

200-199.1 == 0.1 ? 0.3-0.2 == 0.1 ? 工作中遇到几次这样的运算,刚开始也也以为上面的比较肯定是true,看结果 console.log(200-199.1) 0.9000000000000057 undefined console.log(0.3-0.2) 0.09999999999999998 工作中涉及到价格的运算,如果不注意,经常会...

2012-10-07 22:49:00 87

转载 设计模式-装饰模式

装饰模式是为类添加额外的职责。在我看来,这些职责并不是某一个类特有,需要添加的类都可以添加,每个类没有必要单独添加这个职责。 下面是我用js实现的装饰模式 var Employee={ name: '', getName: function(){ return this.name; }, setName: function...

2012-09-12 23:20:00 97

转载 公司网页监控到的各种不能识别的浏览器userAgent,都是些什么啊

ie是通过window.ActiveXObject特性来识别的 mozilla/4.0(compatible;msie8.0;windowsnt6.1;trident/4.0;slcc2;.netclr2.0.50727;.netclr3.5.30729;.netclr3.0.30729;mediacenterpc6.0) mozilla/4.0(compatible;msie7.0...

2012-09-06 20:08:00 248

转载 js模版引擎v6-注解

下面是小C的js模版引擎v6,写得非常精巧。 先看一下怎么使用吧。 var tpl = Template(options, helper).render(); html模版,分隔符分别是<&和&>,@会被解析为"data.",就是你的数据对象,避免了使用with。 <script type="tmpl" id="table_tmpl"&...

2012-09-03 22:36:00 171

转载 document.write

很少用到document.write,不过在动态引入js,又要阻塞后面js执行的时候就可以使用document.write 要阻塞执行,需要把document.write放到一个单独的script标签之内。如: <script type="text/javascript"> document.write("<script type='text/javasc...

2012-08-20 23:02:00 92

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除