The problem in this case is that onchange-event does not fire until the input looses focus, so you will probably want to listen for the keyup-event instead, which is fired on every keystroke.
Also, I would prefer not using inline-javascript, but rather catch the event using jQuery instead.
$("#txtConfirmPassword").keyup(checkPasswordMatch);