Small amount of JavaScript knowledge required
Before I even start I want to point out I did not write this piece of javascript. I am just explaining how it works for your benefit 
Ok, well here goes nothing...
This is the whole javascript code that counts the words for you. (HTML form is added further down)
Code:
<script language="JavaScript">
function countit(){
var formcontent=document.wordcount.wordcount2.value
formcontent=formcontent.split(" ")
document.wordcount.wordcount3.value=formcontent.length
}
</script>
Now to break it down so you can understand 
This part of the javascript is activated when the 'Count Words' button is clicked. It tell the javascript to count the words and send it to the box next to the button.
This next piece of javascript is the part that counts the words and sends the amount back to the form.
wordcount is the form name.
wordcount2 is the box you enter the words you want counted in
and wordcount3 is where the number of words is displayed.
Code:
var formcontent=document.wordcount.wordcount2.value
formcontent=formcontent.split(" ")
document.wordcount.wordcount3.value=formcontent.length
}
The small line of code in the middle reading:
Code:
formcontent=formcontent.split(" ")
Tells the javascript to count every thing after one space.
This means if there are 2 spaces in between words it will count the 2nd space as one word.
Here is the whole Java and HTML code
Code:
<form method="POST" name="wordcount">
<script language="JavaScript">
function countit(){
var formcontent=document.wordcount.wordcount2.value
formcontent=formcontent.split(" ")
document.wordcount.wordcount3.value=formcontent.length
}
</script>
<textarea rows="6" name="wordcount2" cols="30" wrap="virtual"></textarea><br>
<input type="button" value="Count Words" onClick="countit()">
<input type="text" name="wordcount3" size="20" title="Your word count will be displayed here">
</form>
Hope I explained it OK 
All comments appreciated.
Many Thanks
Vauxhall