<html> <body> <SCRIPT LANGUAGE="JavaScript1.2"> function countWords(str){ var count = 0; var words = str.split(" "); for (i=0 ; i < words.length ; i++){ if (words[i] != "") count += 1; } document.theForm.results.value = "There are " + count + " words in the text string you entered!"; } </script> </body> </html>
Related Scripts with Example Source Code in same category :