摘要: JavaScript代码://为String对象增加方法isNullOrEmptyString.isNullOrEmpty = function (a){ if (a != null && a != "" && a != "undefined") return false; return true;}//为window/function增加方法usingNamespacewindow.usingNamespace = Function.usingNamespace = function (a) { var ro = win 阅读全文
posted @ 2013-09-21 16:54 fang_beny 阅读(354) 评论(0) 推荐(0) 编辑
摘要: 脚本部分:function school(sName,sDddress,sPhone,sMail){ this.SName = sName; this.SAddress = sDddress; this.SPhone = sPhone; this.SMail = sMail; this.parmsArray = new Array("test1", "test2", "test3", "test4"); this.index = 0; this.SInfomation = ShowInfomation; this. 阅读全文
posted @ 2013-09-21 15:29 fang_beny 阅读(284) 评论(0) 推荐(0) 编辑
摘要: JavaScript组合拼接字符串的效率。在脚本开发过程中,经常会按照某个规则,组合拼接出一个大字符串进行输出。比如写脚本控件时控制整个控件的外观的HTML标签输出,比如AJAX里得到服务器端的回传值后动态分析创建HTML标签时,不过这里我就不讨论拼接字符串的具体应用了,我只是想在这里讨论一下拼接的效率。字符串的拼接在我们写代码的时候都是用“+=”这个运算符,s += String; 这是我们最为熟知的写法,不知道大家有没有注意过没有,在组合的字符串容量有几十K甚至几百K的时候,脚本执行起来很慢,CPU使用率狂高,例如:varstr="012345678911234567892123 阅读全文
posted @ 2013-09-21 14:34 fang_beny 阅读(302) 评论(0) 推荐(0) 编辑