summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2485db9)
raw | patch | inline | side by side (parent: 2485db9)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 21 Oct 2005 11:25:50 +0000 (11:25 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 21 Oct 2005 11:25:50 +0000 (11:25 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1652 594d385d-05f5-0310-b6e9-bd551577e9d8
html/include/focus.js | patch | blob | history |
diff --git a/html/include/focus.js b/html/include/focus.js
index ba60e13d058d55c7fd428a50fe784d1f9a48d57c..954d2f7afa005ac8c473a124ed7db8e6d74b3bc3 100644 (file)
--- a/html/include/focus.js
+++ b/html/include/focus.js
}
netscape= (ver.charAt(iln+1).toUpperCase() != "C");
-function keyDown(DnEvents) {
+function keyPress(DnEvents) {
// determines whether Netscape or Internet Explorer
k = (netscape) ? DnEvents.which : window.event.keyCode;
if (k == 13) { // enter key pressed
- if (nextfield == 'login'){
- return true; // submit, we finished all fields
- } else { // we're not done yet, send focus to next box
- eval('document.mainform.' + nextfield + '.focus()');
- return false;
- }
- }
+ if(typeof(nextfield)!='undefined') {
+ if(nextfield == 'login') {
+ return true; // submit, we finished all fields
+ } else { // we're not done yet, send focus to next box
+ eval('document.mainform.' + nextfield + '.focus()');
+ return false;
+ }
+ } else {
+ if(netscape) {
+ if(DnEvents.target.type == 'textarea') {
+ return true;
+ } else if (DnEvents.target.type != 'submit') {
+ // TAB
+ var thisfield = document.getElementById(DnEvents.target.id);
+ for (i = 0; i < document.forms[0].elements.length; i++) {
+ if(document.forms[0].elements[i].id==thisfield.id) {
+ // Last form element on page?
+ if(i!=document.forms[0].elements.length-1) {
+ document.forms[0].elements[i+1].focus();
+ }
+ }
+ }
+ return false;
+ } else {
+ return true;
+ }
+ } else {
+ if(window.event.srcElement.type == 'textarea') {
+ return true;
+ } else if (window.event.srcElement.type != 'submit') {
+ // TAB
+ var thisfield = document.getElementById(window.event.srcElement.id);
+ for (i = 0; i < document.forms[0].elements.length; i++) {
+ if(document.forms[0].elements[i].id==thisfield.id) {
+ // Last form element on page?
+ if(i!=document.forms[0].elements.length-1) {
+ document.forms[0].elements[i+1].focus();
+ }
+ }
+ }
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+ }
}
function changeState(myField) {
@@ -67,10 +107,12 @@ function changeTripleSelectState_2nd_neg(firstTriggerField, secondTriggerField,
document.getElementById(myField).disabled= true;
}
}
-
-document.onkeydown= keyDown; // work together to analyze keystrokes
+// work together to analyze keystrokes
if (netscape){
- document.captureEvents(Event.KEYDOWN|Event.KEYUP);
+ document.captureEvents(Event.KEYPRESS);
+ document.onkeypress= keyPress;
+} else {
+ document.onkeypress= keyPress;
}
function hide(element) {