[dev] Re: [cvs] commit: imp compose.php prefs.php imp/config prefs.php.dist imp/docs CHANGES imp/templates/prefs personal.inc

Max Kalika max@the-triumvirate.net
Fri, 03 Nov 2000 15:49:33 -0800 (PST)


Quoting Chuck Hagenbuch <chuck@horde.org>:

> That only happens in IE. It works correctly in NS. If you can come up with
> some magic javascript to get it to work in IE and not affect netscape, I'd use
> it.

I think I got it! (this is in regards to IE putting the cursor at the bottom of 
the message when tabbing from the subject field)

Here's a patch -- seems to work in NS and IE fine.  I haven't really checked 
how the browser detection gets done at the moment so a simple !document.layers 
is in place right now.  This should probably be done better.  I'll leave it to 
you to decide.

--mk23


[root@host compose]# cvs diff -u javascript.inc 
Index: javascript.inc
===================================================================
RCS file: /cvs/horde/imp/templates/compose/javascript.inc,v
retrieving revision 2.26
diff -u -r2.26 javascript.inc
--- javascript.inc      2000/10/31 22:06:17     2.26
+++ javascript.inc      2000/11/03 23:44:58
@@ -272,5 +272,14 @@
     document.compose.elements[4 + 8 * sel].checked = true;
 }
  
+function subjectTab()
+{
+    if(!document.layers) {
+        if(event.keyCode == 9) {
+            event.returnValue = false;
+            document.compose.message.focus();
+        }
+    }
+}
 //-->
 </script>


[root@host compose]# cvs diff -u compose.inc 
Index: compose.inc
===================================================================
RCS file: /cvs/horde/imp/templates/compose/compose.inc,v
retrieving revision 2.74
diff -u -r2.74 compose.inc
--- compose.inc 2000/10/31 22:06:17     2.74
+++ compose.inc 2000/11/03 23:45:06
@@ -143,7 +143,7 @@
 
 <table border="0" width="100%" cellpadding="0">
 <tr>
-    <td align="left">&nbsp;<input type="text" tabindex="4" class="fixed" 
name="subject" value="<?= htmlspecialchars($subject) ?>" size="60"></td>
+    <td align="left">&nbsp;<input type="text" tabindex="4" class="fixed" 
name="subject" value="<?= htmlspecialchars($subject) ?>" size="60" 
onkeydown="subjectTab()"></td>
 <?php if ($conf['user']['online_help'] && $browser->js): ?>
     <td align="right"><?= Help::link('imp', 'compose-subject') ?></td>
 <?php else: ?>