<form name="textForm">
<textArea maxlength="1000" rows="12" cols="30" onchange="countWords(this)"></textArea><br>
<strong>Количество слов в форме:</strong>
<input type="text" size="5" id="word_amount" readonly />
</form>

<script>
function countWords(textarea) {

	if (textarea.value != 0 ) {

		var stringText = textarea.value.replace(/\s{2,}/gi,"");//s all epmty bits more than 2 will be remove


		var text_array = stringText.split(" ");
		document.getElementById("word_amount").value = text_array.length;

	} else {

		document.getElementById("word_amount").value = 0;

	}
}
</script>