From 63cd11d95083ba0fcec3d41d9218500cec8cc3e6 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 9 Jul 2007 08:33:05 +0000 Subject: [PATCH] Updated focus git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6775 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/include/focus.js | 49 +++++++++++++++++----------------- ihtml/themes/default/login.tpl | 2 +- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/html/include/focus.js b/html/include/focus.js index 281f0be89..edc7cda7f 100644 --- a/html/include/focus.js +++ b/html/include/focus.js @@ -403,36 +403,35 @@ function adjust_width(e) { } - -/* Set focus to first valid input field - avoid IExplorer warning about hidding or disabled fields +/* Set focus to first valid input field + avoid IExplorer warning about hidding or disabled fields */ 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 1c6b44e6f..1b5b79afd 100644 --- a/ihtml/themes/default/login.tpl +++ b/ihtml/themes/default/login.tpl @@ -89,7 +89,7 @@ -- 2.30.2