日期:2014-05-16 浏览次数:20364 次
function b() { var txtbody = $(window.frames['FreeTextBox1_designEditor'].document).find('body').html(); var bytelen = 0; var i; for (i = 0; i < txtbody.length; i++) { charCode = txtbody.charCodeAt(i); if (charCode < 0x007f) { bytelen += 1; } else if ((0x0080 <= charCode) && (charCode <= 0x07ff)) { bytelen += 2; } else if ((0x0800 <= charCode) && (charCode <= 0xffff)) { bytelen += 3; } } alert(bytelen); }