The simplest way to do this would be when you submit the form. If you really want to do it as the user enters it, you can use the onkeyup event handler to change the data, but it's going to be more work to make sure that the cursor stays where the user put it (especially if they type in the middle of an existing word).
The Javascript logic for capitalization like this is pretty simple:
function capFirst(oTextBox) {
var sText = oTextBox.value;
sText = sText.substring(0,1).toUpperCase() + sText.substring(1,sText.length);
oTextBox.value = sText;
}