SmileyTextField 组件使用
来源:互联网 发布:买车软件 编辑:程序博客网 时间:2024/05/16 15:22
多谢Luar的指点和分享这些代码,困扰的中文输入会影响表情定位的问题终于解决了。
在组件代码中updatePixelPos方法找到
1 : this.pixel_pos += this.CHAR_WIDTH_MAP[Math.min(1, this.is_bold)][string.charCodeAt(pos)];
替换成下面这段代码:
1 : //*************************************************************
2 : // Because all English Characters' width is stored in Array
3 : // If return undefined, it is Chinese character,
4 : // Hardcode Chinese character width = 13
5 : //*************************************************************
6 : var ccWIDTH = this.CHAR_WIDTH_MAP[Math.min(1, this.is_bold)][string.charCodeAt(pos)];
7 : ccWIDTH = (ccWIDTH == undefined) ? 13 : ccWIDTH;//这行就是解决问题的所在
8 : this.pixel_pos += ccWIDTH;
2 : // Because all English Characters' width is stored in Array
3 : // If return undefined, it is Chinese character,
4 : // Hardcode Chinese character width = 13
5 : //*************************************************************
6 : var ccWIDTH = this.CHAR_WIDTH_MAP[Math.min(1, this.is_bold)][string.charCodeAt(pos)];
7 : ccWIDTH = (ccWIDTH == undefined) ? 13 : ccWIDTH;//这行就是解决问题的所在
8 : this.pixel_pos += ccWIDTH;
然后在parseHtmlShortcuts方法中找到
1 : test_pos += this.CHAR_WIDTH_MAP[Math.min(1, this.is_bold)][shortcut_str.charCodeAt(j)];
替换成下面代码:
//*************************************************************
// Because all English Characters' width is stored in Array
// If return undefined, it is Chinese character,
// Hardcode Chinese character width = 13
//*************************************************************
var ccWIDTH = this.CHAR_WIDTH_MAP[Math.min(1, this.is_bold)][shortcut_str.charCodeAt(j)];
ccWIDTH = (ccWIDTH == undefined) ? 13 : ccWIDTH;
test_pos += ccWIDTH;
//
// Because all English Characters' width is stored in Array
// If return undefined, it is Chinese character,
// Hardcode Chinese character width = 13
//*************************************************************
var ccWIDTH = this.CHAR_WIDTH_MAP[Math.min(1, this.is_bold)][shortcut_str.charCodeAt(j)];
ccWIDTH = (ccWIDTH == undefined) ? 13 : ccWIDTH;
test_pos += ccWIDTH;
//
以上均引用luar的修改代码,非常感谢luar!
- SmileyTextField 组件使用
- 使用组件搜索
- 使用排队组件
- 使用JavaBean组件
- 日期组件的使用
- jsp使用com组件
- 学习组件的使用:
- 使用flashMX2004组件有感
- Flash组件的使用
- 使用 MIDP 列表组件
- 使用Fileupload上传组件
- 使用Fileupload上传组件
- 使用组件的样式
- ASP图象组件使用
- COM组件的使用
- JMail组件的使用
- 使用JTable组件
- 使用Ajax评级组件
- Serv-U本地权限提升漏洞
- 子查询的基本特征:
- 第一篇文章,摘录了几段话
- SQL Server 2000安装
- 十天学会ASP
- SmileyTextField 组件使用
- vsftpd - Very Secure FTP Daemon 简介
- 一个客户端异步读取XML+XSL并进行转换的例子
- asp.net资源连接(转载)
- System.Directory___DTString
- WebSphere Studio Application Developer 中的 Web 应用程序入门
- 痛
- 在ASP.NET中动态包含文件
- rsync