点击此处进行全屏查看

©2011 Copyright Ider Zheng


此项目中用到的Javascript偏门知识

prototype扩展已有的Javascript对象:

String.prototype.trim = function(){return this.replace(/^\s+|\s+$/g, "");}

Getter只读属性器:

    get EndlineMatcher()
{
return /\n|\r|\r\n/g;
},

String.replace方法接受函数作为参数:

function HtmlEncode(original)
{
var result =
original.replace(
/\n|\r|\r\n| {2,}/g
,
function ($0)
{
if($0[0] == " ") return TextFormat.Space($0.length);

return "<br />" + $0;
}
);
return result;
}

使用数组进行字符串重复:

    Space: function(num)
{
var times = parseInt(num);
times
= (times == NaN? 1:times+1); // times+1 length array has times intervals

return new Array(times).join("&nbsp;");
}

作者: Ider 发表于 2011-08-29 07:39 原文链接

推荐.NET配套的通用数据层ORM框架:CYQ.Data 通用数据层框架
新浪微博粉丝精灵,刷粉丝、刷评论、刷转发、企业商家微博营销必备工具"