2012年12月19日
摘要: Object.extend = function(destination, source){ for (var property in source) { destination[property] = source[property]; } return destination; }/*字符串*/var string = new String("hello");var string1 = string;var string2 = string;string1 = string1+" world... 阅读全文
posted @ 2012-12-19 08:41 somesayss 阅读(299) 评论(0) 推荐(0) 编辑
  2012年12月15日
摘要: <script type="text/javascript">var Class = { create:function(){ return function(){ this.init.apply(this,arguments); } }, extend:function(current,target,futher){ for(var i in target.prototype){ current.prototype[i] = target.prototype[i] ... 阅读全文
posted @ 2012-12-15 22:40 somesayss 阅读(5006) 评论(0) 推荐(0) 编辑
  2012年12月14日
摘要: <a href="javascript:void(0)">hello</a>/* * JS中函数void()的运用大体是这种新式; * void()是运算符,对任何值都返回undefined;和typeof运算符号一样可以 void(0) = void 0; * void function main(){}; 申明此函数返回的是 undefined; 没有 return 的函数默认也是返回 undefined ;所以没有写的必要,也上是为了语义化.? * 所以上面链接的形式也可是: javascript:void '' , javas 阅读全文
posted @ 2012-12-14 22:31 somesayss 阅读(8931) 评论(0) 推荐(1) 编辑
  2012年12月12日
摘要: /* * 静态页面要施放因(add)此元素添加事件的内存. */<input id="add" type="button" value="add" /><input id="det" type="button" value="det" /><script type="text/javascript">(function(){ var add = document.getElementById("add" 阅读全文
posted @ 2012-12-12 20:59 somesayss 阅读(29327) 评论(0) 推荐(0) 编辑
  2012年12月10日
摘要: /* * 应为mouseover,mouseout, 会在里面的元素划过的时候也触发事件,所以去做下面两个函数; * contains(); 这函数真的很是强大啊..... */<style type="text/css">.mian{height:200px;background:#CCC;overflow:hidden;}.box{width:960px;height:100px;background:#000;margin:50px auto 0 auto;}</style><div class="mian" id=& 阅读全文
posted @ 2012-12-10 22:27 somesayss 阅读(1220) 评论(0) 推荐(0) 编辑
  2012年12月5日
摘要: /* * 经典版,第一次看到的是在一个淘宝的面试题上. */<style type="text/css">.main{width:500px;height:400px;margin:100px auto 0 auto;}.imgbox{width:500px;height:400px;display:table-cell;vertical-align:middle;background:#CCC;text-align:center;overflow:hidden;*display:block;*font-size:350px;*font-family:Arial 阅读全文
posted @ 2012-12-05 21:01 somesayss 阅读(199) 评论(0) 推荐(0) 编辑
  2012年12月1日
摘要: /** 相关参考地址 ease 函数 和 animate 函数的思想 http://www.cnblogs.com/rubylouvre/archive/2009/09/17/1567607.html* 我做的只是简单的封装而已*/<style type="text/css">.main{position:relative;width:960px;margin:50px auto 0 auto;height:100px;background:#CCC;}.box_1{position:absolute;width:50px;height:50px;backgro 阅读全文
posted @ 2012-12-01 21:13 somesayss 阅读(1753) 评论(0) 推荐(0) 编辑
  2012年11月25日
摘要: /* * Function.prototype.bind 外置函数; * 当连续bind事件的时候无法保证顺序; */if(!Function.prototype.bind){ Function.prototype.bind = function(){ var args = Array.prototype.slice.call(arguments); var _obj = args.shift(); var _fun = this; return function(){ return _fun.apply(_o... 阅读全文
posted @ 2012-11-25 20:54 somesayss 阅读(1196) 评论(0) 推荐(0) 编辑
  2012年11月23日
摘要: /* * o.name 这属性在IE下会返回 undefined, 如果o是匿名函数在标准浏览器下回返回"",非匿名函数会返回函数名. */<script type="text/javascript">var o = function(){}o.myage = 18;o.myname = "shao";o.prototype.show = "hello";var a = new o();alert(o.hasOwnProperty("myname")); //true 检查属性(&q 阅读全文
posted @ 2012-11-23 10:08 somesayss 阅读(303) 评论(0) 推荐(0) 编辑
  2012年11月19日
摘要: /* * 函数的返回值可以返回,number,string,boolean,null,undefined,object; * 当函数的没有返回值的时候,他其实是返回undefined!!也就是h(); */<script type="text/javascript">var a = function(){ return 1; }var b = function(){ return "a"; }var c = function(){ return true; }var d = function(){ return null; }var f = 阅读全文
posted @ 2012-11-19 16:43 somesayss 阅读(16562) 评论(0) 推荐(1) 编辑