日期:2014-05-16  浏览次数:20393 次

js 字数统计,区分英汉
hta实现的字数统计效果代码,中文算两个,英文算一个

<hta:application windowstate=maximize singleInStance=1 applicationName=text>
<STYLE>
TEXTAREA{border-color=F00;background=TransParent;font=600 15/1.3;color=blue;height=100%;overflow-Y=hidden}
#t{behavior=url(#default#time2)}
</STYLE>
<body style=margin=5 scroll=no>
<Q id=e style=position=absolute;top=49%;left=45%;background=ccc;width=69;z-index=-9;color=blue>
<Q id=E begin=0;E.end dur=5ms onmouseover='e.style.backgroundColor=000;style.color="yellow"' onmouseout='e.style.backgroundColor="CCC";style.color="00f";'style='behavior=url(#default#time2);color=00f;
font=600 16;padding=2;width=1;letter-spacing=3;filter=glow(color=RED,strength=3)' onbegin=document.title=innerText=Date().slice(-13,-5)></Q><q id=info></q></Q>
<textarea id=T dir=rtl readOnly style=border-right=0;width=38;height=100%></textarea><textarea id=t onpropertyChange="Len=value.replace(/(\r\n)$/gm,'').split(''),len=len0=Len.length;for(o in Len)if(Len[o].charCodeAt(0)>256)len++;info.innerText=len0+'字符\n'+len+'字节'" style='text-decoration=underline0;border-left=0' onbegin="style.width=document.body.offsetWidth-60;AR=[],AR.length=999;for(i=0;i<AR.length;i++)AR[i]=i+1;T.value=AR.join('\r');AR=[],AR.length=999;value=AR.join('\n')" onscroll=T.scrollTop=scrollTop></textarea>
<script>
function SaveAs5(imgURL){
oPop=window.open(imgURL,0,"width=1,left=3000"); for(;oPop.document.readyState != "complete";)
{if(oPop.document.readyState == "complete")break; }
oPop.document.execCommand("SaveAs"); oPop.close(); } </script> <input value='text.hta' size=9 onclick="SaveAs5(value)" accesskey=X>