alert("Textbox has "+number_of_words.length+" words");
Now here's the code that will made textarea in your webpage.
<textarea name="details"> </textarea>
<input type="submit" value="Check" onclick="return counting_words(document.form1.details)"></form>
Now when you will entered the words in textarea and then press submit button then an alert will come that will show you how many words you have entered in the textrea.