It is common for me to register javascript functions for certain events by doing something like:
myBtn.Attributes.Add(\"onClick\", \"Validate(getElementById(
You should only use document.getElementById (even if I'd recommend using libraries like prototype or jquery to be able to use the $ sign).
If you are able to use getElementById on its own, it's just because the browser you're using is doing some kind of trick to get it to work, but the correct way is to use the document variable.