If you are passing element
directly to a function, call focus
directly on that.
function focus(element) {
element.focus();
}
If you are just passing the name of an element to a function, then ..
function focus(element) {
document.form[element].focus();
}
source
to share