摘要: DOMready的构建方法不再重复,现代浏览器通过DOMContentLoaded来实现,IE通过readystatechange+doScroll来模拟该方法.类似jquery中的document.ready.该方法在99%的情况下在两类浏览器中表现方式是相同的.这里来看下1%的情况.在页面中嵌套了iframe的情况下.现代浏览器的执行顺序是:解析index-->index的DOMready-->解析iframe-->iframe的DOMready-->iframe的window.onload-->index的window.onload;IE的执行顺序是:解析i 阅读全文
posted @ 2012-11-08 15:44 zwei1989 阅读(2160) 评论(1) 推荐(0) 编辑
摘要: Object.getPrototypeOf(object):调用对象父类原型上的方法;function Person(){ this.method1 = function(){alert(1)}}Person.prototype.method2 = function(){alert(2);} function Man(){ this.m1 = function(){ Object.getPrototypeOf(this).method1(); }}Man.prototype = new Person(); Man.prototype.m2 = function(... 阅读全文
posted @ 2012-10-25 11:45 zwei1989 阅读(2433) 评论(0) 推荐(1) 编辑
摘要: 其实肯定会有人问为啥用了transform,为什么动画过程不用transition.当时也考虑过,因为[链接:点击这里],所以决定直接用js做动画了.现在搞了个transition的版本出来function BOX_show2(obj,id,on){ this.obj=obj; this.box=document.getElementById(id); this.oWidth = parseInt(this.getStyle(this.box, 'width')); this.oHeight = parseInt(this.getStyle(this.box, 'hei 阅读全文
posted @ 2012-10-18 15:26 zwei1989 阅读(240) 评论(0) 推荐(0) 编辑
摘要: 新增遮罩层,弹回动画,支持滚动,优化function BOX_show2(obj,id,on){ this.obj=obj; this.box=document.getElementById(id); this.oWidth = parseInt(this.getStyle(this.box, 'width')); this.oHeight = parseInt(this.getStyle(this.box, 'height')); var _this=this; this.obj.onclick=function(ev){ var e=ev|... 阅读全文
posted @ 2012-10-17 17:19 zwei1989 阅读(394) 评论(0) 推荐(0) 编辑
摘要: CSS3属性,主要用于弹窗有背景图片.function BOX_show2(obj,id){ this.obj=obj; this.box=document.getElementById(id); var oWidth = parseInt(this.getStyle(this.box, 'width')); this.oLeft = parseInt((document.documentElement.clientWidth - oWidth) / 2); var _this=this; this.obj.onclick=function(ev){ ... 阅读全文
posted @ 2012-10-16 16:22 zwei1989 阅读(186) 评论(0) 推荐(0) 编辑
摘要: hasOwnProperty:是用来判断一个对象是否有你给出名称的属性或对象。此方法无法检查该对象的原型链中是否具有该属性,该属性必须是对象本身的一个成员。object.hasOwnProperty(proName);判断proName的名称是不是object对象的一个属性或对象。"Test String".hasOwnProperty("split"); // falseString.prototype.hasOwnProperty("split"); //true 阅读全文
posted @ 2012-10-15 14:46 zwei1989 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 注册事件有两个MozMousePixelScroll,DOMMouseScroll,但是它们不能使用element.onDOMMouseScroll方式注册,必须使用addEventLinstener来监听事件Firefox没有event.wheelDelta,它使用event.detail 来获取滚动的信息event.detail 本身是用来记录一个事件在原地(鼠标坐标不发生变化的情况下)执行了多少次的信息而在DOMMouseScroll事件发生的时候,它的值通常是 3 和 -3但是它的取值和IE正好相反, 向上是负,向下是正为什么说它的值通常是 3和-3呢,因为当你按住ctrl ,alt, 阅读全文
posted @ 2012-10-12 15:51 zwei1989 阅读(166) 评论(0) 推荐(0) 编辑
摘要: <head><style type="text/css">.box{ position:relative; width:500px; height:500px; margin:100px auto; border:#03C solid 2px;-moz-perspective: 1500px;}.a{-moz-transform-style: preserve-3d;-moz-transition-duration: 1000ms;-moz-transition-property: all;-moz-transition-timing-functio 阅读全文
posted @ 2012-10-12 15:30 zwei1989 阅读(1178) 评论(0) 推荐(0) 编辑
摘要: obj.offsetTop 指 obj 距离上方或上层控件的位置,整型,单位像素。在float等奇怪的特殊情况下并不是上面所说的,需要给每个上级都加上position:relative或者position:absolute; 阅读全文
posted @ 2012-10-12 15:28 zwei1989 阅读(190) 评论(0) 推荐(0) 编辑
摘要: function BOX_show_main(id, btn, e, on) { this.btn = btn; this.e=e; this.obj = document.getElementById(id); this.scrTop=document.documentElement.scrollTop||document.body.scrollTop; var oWidth = parseInt(this.getStyle(this.obj, 'width')); var oHeight = parseInt(this.getStyle(this.obj... 阅读全文
posted @ 2012-10-12 15:03 zwei1989 阅读(379) 评论(0) 推荐(0) 编辑