User:Zocky/wc.js

function $(id){return document.getElementById(id)}

$(wcInit);

function wcInit { code = ' ' + ' '      + ' '; $('content').innerHTML=code+$('content').innerHTML; } function wcGo { text = $('wcText').value; result=text.length+" characters ";

result+=(n = text.replace(/\s+/g,'').length) + " non-space characters "; result+=text.split(/\s+/).length + " words "; result+=Math.ceil(n/750)/2 + " standard pages "; $('wcResult').innerHTML=result; }