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

$(wcInit);

function wcInit()
{
  code = '<textarea id="wcText" style="width:100%;height:400px"></textarea>'
       + '<div id="wcResult" style="height:7em;background:#def"></div>'
       + '<input type="button" value="go" onclick="wcGo()"><p>';
  $('content').innerHTML=code+$('content').innerHTML;
}
function wcGo()
{
  text = $('wcText').value;
  result=text.length+" characters<br>";

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