摘要: 一般继承方式如下function people(n){ this.name =n;}function worker(name,num){ people.call(this, name); this.num =num;}worker.prototype =new people()worker.prototype.constructor = worker1 原型方式比较灵活function people(n){ this.name =n;}可以先生成对象,然后添加原型方法var p1 = new people('zj')people.prototype.show = f... 阅读全文
posted @ 2013-10-31 10:09 oneroom 阅读(181) 评论(0) 推荐(0) 编辑
摘要: <!--[iflteIE7]><scripttype="text/javascript">(function($){$.fn.pozFixed=function(params){vardefaults={top:400,left:'50%',interval:100};defaults=$.extend(defaults,params);returnthis.each(function(i,o){var$this=$(this);this.fixPosition=function(){varst=$().scrollTop();$th 阅读全文
posted @ 2011-09-28 16:20 oneroom 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 1try{23 top.location.hostname;45 if(top.location.hostname!=window.location.hostname){67 top.location.href=window.location.href;89 }1011}1213catch(e){1415 top.location.href=window.location.href;1617} 阅读全文
posted @ 2011-08-30 10:09 oneroom 阅读(232) 评论(0) 推荐(0) 编辑
摘要: Ajax中请求被缓存的问题在Ajax开发中,会遇到浏览器缓存内容的问题,比如,某个元素注册了鼠标事件(onmouseover),事件触发后会通过xmlhttprequest到服务器获取内容,在不刷新页面的情况下,浏览器会缓存第一次请求的内容,服务端更新后浏览器仍然显示第一次的内容。通常,这种请求都是xmlhttprequest发起的GET请求。根据HTTP规范,GET用于信息获取,而且应该是幂等的。也就是说,当使用相同的URL重复GET请求会返回预期的相同结果时,GET方法才是适用的。当对一个请求有副作用的时候(例如,提交数据注册新用户时),应该使用POST请求而不是GET。所以浏览器会对G. 阅读全文
posted @ 2011-05-16 10:51 oneroom 阅读(396) 评论(0) 推荐(0) 编辑
摘要: 在javascript的事件绑定中,我们经常用到的方法是functionaddListener(el,event,fn,bCapture){varisCapture=bCapture?bCapture:false;try{el.addEventListener(event,fn,isCapture);}catch(e){try{el.attachEvent('on'+event,fn);}catch(e){el['on'+event]=fn;}}}function whatIsThis(){ if (this === window) { alert('T 阅读全文
posted @ 2011-03-03 11:10 oneroom 阅读(774) 评论(1) 推荐(0) 编辑
摘要: 今天在工作中要通过textarea 获取用户的空格和回车 ,保存好用户的格式,在前台显示,总是遇到空格和换行的问题,就仔细研究了下,因为在ie和火狐中老是不兼容,在网上找了下也没找到好的解决办法,于是通过转码明白了ie和火狐中换行的代码不一样,火狐中是\n,IE下是\r\n,通过16进制对照ascii可以查看。解决办法如下 $$("result").innerHTML=content.value.toString().replace(/(\r)*\n/g,"br/").replace(/\s/g," "); 特记录下。demo如下。/Files/oneroom/demo.rar 阅读全文
posted @ 2011-01-14 00:05 oneroom 阅读(560) 评论(1) 推荐(2) 编辑
摘要: [代码] 阅读全文
posted @ 2010-12-29 00:00 oneroom 阅读(1193) 评论(6) 推荐(0) 编辑
摘要: 今天在编码时,遇到一个问题,特记录下。[代码]console.log(arr.length);结果是4arr.f1();arr= test();console.log(arr.length);结果是4这个好理解;二:var arr= test();console.log(arr.length);结果是4arr.f2();arr= test();console.log(arr.length);结果是0 不知道为什么会这样,难道arr.f2()可以修改test函数中闭包中的arr2; 阅读全文
posted @ 2010-12-28 23:20 oneroom 阅读(178) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta c... 阅读全文
posted @ 2010-12-20 23:05 oneroom 阅读(166) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/vivounicorn/archive/2009/08/23/1552416.html 深入了解CLR的加载过程 阅读全文
posted @ 2010-11-23 16:44 oneroom 阅读(205) 评论(0) 推荐(0) 编辑
让别人快乐是慈悲,让自己快乐是智慧!