It is common for me to register javascript functions for certain events by doing something like:
myBtn.Attributes.Add(\"onClick\", \"Validate(getElementById(
You should use the full document.getElementById(). If you find that too verbose, you could use jQuery:
document.getElementById()
$('#' + id)
or you could create an alias at the top of your script:
var byID = document.getElementById;