Code

Added tab-insert for textarea-elements.
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 21 Oct 2005 12:10:50 +0000 (12:10 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 21 Oct 2005 12:10:50 +0000 (12:10 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1656 594d385d-05f5-0310-b6e9-bd551577e9d8

html/include/focus.js

index 954d2f7afa005ac8c473a124ed7db8e6d74b3bc3..2629d7d86f8f3e9f48ad08695bc47fad4bb673f1 100644 (file)
@@ -16,7 +16,7 @@ netscape= (ver.charAt(iln+1).toUpperCase() != "C");
 
 function keyPress(DnEvents) {
   // determines whether Netscape or Internet Explorer
-  k = (netscape) ? DnEvents.which : window.event.keyCode;
+  k = (netscape) ? DnEvents.keyCode : window.event.keyCode;
   if (k == 13) { // enter key pressed
                if(typeof(nextfield)!='undefined') {
                        if(nextfield == 'login') {
@@ -64,6 +64,19 @@ function keyPress(DnEvents) {
                                }
                        }
                }
+       } else if (k==9) {
+               // Tab key pressed
+               if(netscape) {
+                       if(DnEvents.target.type == 'textarea') {
+                               document.getElementById(DnEvents.target.id).value+="\t";
+                               return false;
+                       }
+               } else {
+                       if(window.event.srcElement.type == 'textarea') {
+                               document.getElementById(window.event.srcElement.id).value+="\t";
+                               return false;
+                       }
+               }
        }
 }