From 536c93c6c19d4bf0e485803472a5792d48bd2ce3 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 9 Jul 2007 08:32:21 +0000 Subject: [PATCH] Updated focus git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6774 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/include/focus.js | 41 +++++++++++++++++----------------- ihtml/themes/default/login.tpl | 2 +- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/html/include/focus.js b/html/include/focus.js index 99e73b14c..710d741d5 100644 --- a/html/include/focus.js +++ b/html/include/focus.js @@ -342,30 +342,29 @@ function adjust_width(e) { */ function focus_field() { - var i = 0; - while(focus_field.arguments[i] && document.getElementById(focus_field.arguments[i]).disabled == true) { - i++; - } - if(focus_field.arguments[i]){ - - var name = focus_field.arguments[i]; - var element = document.getElementsByName(name); - - for(i = 0; i < element.length; i++) { - if(element[i].id == name && ( - element[i].type != 'none' || - element[i].type != 'hidden') - ) { - element[i].blur(); - element[i].focus(); - break; - } - } - } -} + var i = 0; + var e = 0; + var found = false; + var element_name = ""; + var element =null; + while(focus_field.arguments[i] && !found){ + var tmp = document.getElementsByName(focus_field.arguments[i]); + for(e = 0 ; e < tmp.length ; e ++ ){ + if(tmp[e].disabled != true && tmp[e].type != "none" && tmp[e].type != "hidden" ){ + found = true; + element = tmp[e]; + } + } + i++; + } + if(element && found){ + element.blur(); + element.focus(); + } +} // vim:ts=2:syntax diff --git a/ihtml/themes/default/login.tpl b/ihtml/themes/default/login.tpl index 900c2b919..aab9b08b6 100644 --- a/ihtml/themes/default/login.tpl +++ b/ihtml/themes/default/login.tpl @@ -87,7 +87,7 @@ -- 2.30.2