Created
October 18, 2017 15:58
-
-
Save FernandoBasso/cbe8d6d927b5bb19d1652c6600d1c809 to your computer and use it in GitHub Desktop.
Marvelous piece of javascript found in a legacy project I am maintaining
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function foco(formulario){ | |
elementos = document.getElementById(formulario).elements; | |
for (i=0; i<elementos.length; i++) { | |
if (elementos[i].hasAttribute("setFocus")) { | |
obr = elementos[i].getAttribute("type"); | |
if(obr == "text") elementos[i].select(); else elementos[i].focus(); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment