摘要: JavaScript操作Cookie 插件,标注已经很清楚了,请看具体代码://Cookie类 function Cookie(){ Cookie.prototype=new Object();//继承自Object this.constructor=Cookie; //重写toString函数,生成为document.cookie形式的字符串 Cookie.prototype.toString=function(){ var data=[];//存放cookie子键 var _cookie=[];//存放cookie键值对 for(var prop in this){ switch(true 阅读全文
posted @ 2011-08-02 10:02 灵雨飘零 阅读(215) 评论(0) 推荐(0) 编辑
摘要: <style type="text/css"> <!-- .div1{ width:200px; } .div1 span{ white-space:nowrap; text-overflow:ellipsis; *text-overflow:ellipsis; /* for ie6 ie7 */ overflow:hidden; width:168px; display:block; float:left; } html>body .div1:aft... 阅读全文
posted @ 2011-08-02 09:52 灵雨飘零 阅读(443) 评论(0) 推荐(1) 编辑
摘要: C# 获取汉语拼音全码及简码,代码如下:public static class SpellCodeHelper { public static string GetChineseSpellCode(string unicodeString) { int i = 0; ushort key = 0; string strResult = string.Empty; //创建两个不同的encoding对象 Encoding unicode = Encoding.Unicode; //创建GBK码对象 Encoding gbk = Encoding.GetEncoding(936); //将unic 阅读全文
posted @ 2011-08-02 09:38 灵雨飘零 阅读(3087) 评论(0) 推荐(0) 编辑
摘要: 在排版中我们基本认为一个英文字符占据宽度基本为汉字的1/2,twitter中的140个字符,用英语来写的话其实写不几个单词,而中文的140个汉字就基本能把一个观点表达清楚。因此有些情况是要求英文字符是按中文字符的半个来计算的,那么可以使用正则表达式来匹配每个字符是否为汉字。以下根据不同需要来进行匹配[\u4E00-\u9FA5] 匹配简体[\u4E00-\u9FFF] 匹配简体和繁体[\u2E80-\u9FFF] 匹配所有东亚区的语言/// <summary>/// 检查中英文混合字符长度(英文字符算0.5,中文算1)/// </summary>/// <para 阅读全文
posted @ 2011-08-02 09:36 灵雨飘零 阅读(379) 评论(0) 推荐(1) 编辑