Creating a Javascript Word Count Tool is very easy. The following code can be pasted as a new HTML file and executed directly in a web browser. After executing the html file in the browser, the just paste the contents in the text box and click the "Count the Words" button which starts the Javascript word count tool execution, and the result is displayed.
<html>
<head>
<title>Javascript Word Count Tool</title>
<script language="JavaScript" type="text/javascript">
function wordCount()
{
frmwordcount.txtwordcountresult.value=frmwordcount.txtwordcount.value.split(" ").length;
}
</script>
</head>
<body>
<form method="POST" name="frmwordcount">
<textarea name="txtwordcount" cols="60" rows="10" id="txtwordcount"></textarea><br/>
<input name="btncount" type="button" id="btncount" onClick="wordCount()" value="Count the Words">
<input name="txtwordcountresult" type="text" id="txtwordcountresult" size="10">
</form>
</body>
</html>