function WebForm_FindFirstFocusableChild(control) { if (control null || control.tagName null) { return null; } var tagName = control.tagName.toLowerCase(); if (tagName == "undefined") { return null; } var children = control.childNodes; if (children != null) { for (var i = 0; i < children.length; i++) { try { if (WebForm_CanFocus(children[i])) { return children[i]; } else { var focused = WebForm_FindFirstFocusableChild(children[i]); if (WebForm_CanFocus(focused)) { return focused; } } } catch (e) { } } } return null; } function WebForm_AutoFocus(focusId) { var targetControl; if (__nonMSDOMBrowser) { targetControl = document.getElementById(focusId); } else { targetControl = document.all[focusId]; } var focused = targetControl; if (targetControl != null && (!WebForm_CanFocus(targetControl)) ) { focused = WebForm_FindFirstFocusableChild(targetControl); } if (focused != null) { try { focused.focus(); focused.scrollIntoView(); if (window.__smartNav != null) { window.__smartNav.ae = focused.id; } } catch (e) { } } } function WebForm_CanFocus(element) { if (element null || element.tagName null) return false; var tagName = element.tagName.toLowerCase(); return ((element.disabled null || element.disabled false) && (element.type == null || element.type.toLowerCase() != "hidden") && WebForm_IsFocusableTag(tagName) && WebForm_IsInVisibleContainer(element) ); } function WebForm_IsFocusableTag(tagName) { return (tagName == "input" || tagName == "textarea" || tagName == "select" || tagName == "button" || tagName == "a"); } function WebForm_IsInVisibleContainer(ctrl) { if (ctrl.disabled == true || ( typeof(ctrl.style) != "undefined" && ( ( typeof(ctrl.style.display) != "undefined" && ctrl.style.display == "none") || ( typeof(ctrl.style.visibility) != "undefined" && ctrl.style.visibility == "hidden") ) ) ) { return false; } else if (typeof(ctrl.parentNode) != "undefined" && ctrl.parentNode != null && ctrl.parentNode != ctrl) { return WebForm_IsInVisibleContainer(ctrl.parentNode); } return true; }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question