function window.onload() { var elements = document.getElementsByTagName("*"); for (var i = 0; i < elements.length; i++) { var element = elements[i]; if (((/^input$/i.test(element.tagName) && /^(text|checkbox|radio|radio)$/i.test(element.type) && !element.readonly) || (/^textarea$/i.test(element.tagName) && !element.readonly) || (/^select$/i.test(element.tagName))) &&!element.disabled) { var style = element.currentStyle || document.defaultView.getComputedStyle(element, null); if (style.display == "none" || style.visibility == "hidden") { continue; }else{ element.focus(); break; } } } }