<HTML>
<HEAD>
<SCRIPT>
function capWords(str){
words = str.split(" ");
for (i=0 ; i < words.length ; i++){
testwd = words[i];
firLet = testwd.substr(0,1); //lop off first letter
rest = testwd.substr(1, testwd.length -1)
words[i] = firLet.toUpperCase() + rest
}
document.theForm.results.value = words.join(" ");
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="theForm">
Enter a text string:
<TEXTAREA name=inStr rows=5 cols=90>
</TEXTAREA>
<INPUT type=button value="Capitalize Words" onClick="capWords(document.theForm.inStr.value)";>
<INPUT type=button name="theButton" value="Clear Results" onClick='document.theForm.results.value=""';>
Results<br>
<TEXTAREA name=results rows=5 cols=90>
</TEXTAREA>
</FORM>
</BODY>
</HTML>