摘要: 禁止输入法形式:<INPUT TYPE=text STYLE="ime-mode:disabled" >参数说明形式:active 代表输入法为中文inactive 代表输入法为英文auto 代表打开输入法 (默认)disable 代表关闭输入法具体例子如下:<INPUT onfocus=" this.style.imeMode='active' " /><INPUT onfocus=" this.style.imeMode='inactive' " /><IN 阅读全文
posted @ 2013-04-06 22:37 fanhc019 阅读(844) 评论(0) 推荐(0) 编辑
摘要: function parent(e, n){ var n = n || 1; while(n-- && e){ e = e.parentNode(); } if(!e || e.nodeType != 1){ return null; } return e; } function sibling(e, n){ while(e && n !==0){ ... 阅读全文
posted @ 2013-08-27 08:43 fanhc019 阅读(291) 评论(0) 推荐(0) 编辑
摘要: function type(o){ var t, c, n; if(o === null) return 'null'; if(o !== o) return 'nan'; if((t = typeof o) !== 'object') return t; if((c = classof(o) !== 'Object')) return c; if(o.constructor && typeof o.construc... 阅读全文
posted @ 2013-08-20 08:26 fanhc019 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 1 function memorize(f){ 2 var cache = {}; 3 return function(){ 4 var key = arguments.length + Array.prototype.join.apply(this,arguments); 5 if(key in cache){ 6 7 return cache[key]; 8 ... 阅读全文
posted @ 2013-08-13 14:21 fanhc019 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 1 function not(f){ 2 return function(){ 3 var result = f.apply(this,arguments); 4 return !result; 5 } 6 } 7 var even = function(x){ 8 return x%2 === 0; 9 }10 var o... 阅读全文
posted @ 2013-08-13 14:14 fanhc019 阅读(138) 评论(0) 推荐(0) 编辑
摘要: function array(a,n){ return Array.prototype.slice.call(a,n || 0); } //the arguments to this function are passed on the left function particalLeft(f){ var args = arguments; return function(){ var a = arra... 阅读全文
posted @ 2013-08-13 14:08 fanhc019 阅读(523) 评论(0) 推荐(0) 编辑
摘要: 首先解释下宿主环境:一般宿主环境由外壳程序创建与维护,只要能提供js引擎执行的环境都可称之为外壳程序。如:web浏览器,一些桌面应用系统等。即由web浏览器或是这些桌面应用系统早就的环境即宿主环境。本地对象ECMA-262 把本地对象(native object)定义为“独立于宿主环境的 ECMAScript 实现提供的对象”。再来看一下,“本地对象”包含哪些内容:Object、Function、Array、String、Boolean、Number、Date、RegExp、Error、EvalError、RangeError、ReferenceError、SyntaxError、TypeEr 阅读全文
posted @ 2013-04-09 22:58 fanhc019 阅读(1119) 评论(0) 推荐(0) 编辑
摘要: 总算弄明白了为何用document.body.clientHeight,document.body.offsetHeight都没有办法获取网页可 见区域的正确值,原来罪魁祸首是W3C定义的标准!!在新定义出来的标准下 document.documentElement.clientHeight在IE和火狐里都能获取正确值,下面一篇文章详细介绍了获取各种浏览器可见 窗口大小这方面的差别:<script>function getInfo(){ var s = ""; s += " 网页可见区域宽:"+ document.body.clientWid 阅读全文
posted @ 2013-04-06 23:03 fanhc019 阅读(246) 评论(0) 推荐(0) 编辑
摘要: JavaScript是一门基于原型的语言,但它却拥有一个 new 操作符使得其看起来象一门经典的面对对象语言。那样也迷惑了程序员们,导致一些有问题的编程模式。其实你永远不需要在JavaScript使用 new Object()。用字面量的形式{}去取代吧。同理,不要使用 new Array() ,而代之以字面量[]。JavaScript中的数组并不象Java中的数组那样工作的,使用类似Java的语法只会让你糊涂。同理不用使用 new Number, new String, 或者 new Boolean。这些的用法只会产生无用的类型封装对象。就直接使用简单的字面量吧。不要使用 new Funct 阅读全文
posted @ 2013-04-06 22:59 fanhc019 阅读(189) 评论(0) 推荐(0) 编辑
摘要: response.setContentType(MIME)的作用是使客户端浏览器,区分不同种类的数据,并根据不同的MIME调用浏览器内不同的程序嵌入模块来处理相应的数据。例如web浏览器就是通过MIME类型来判断文件是GIF图片。通过MIME类型来处理json字符串。Tomcat的安装目录\conf\web.xml 中就定义了大量MIME类型 ,可以参考。response.setContentType("text/html; charset=utf-8"); html.setContentType("text/plain; charset=utf-8") 阅读全文
posted @ 2012-09-21 09:15 fanhc019 阅读(9442) 评论(0) 推荐(0) 编辑