]> git.wh0rd.org Git - tt-rss.git/commitdiff
focus username input element on login form load (closes #70)
authorAndrew Dolgov <fox@madoka.spb.ru>
Wed, 14 Jun 2006 07:32:10 +0000 (08:32 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Wed, 14 Jun 2006 07:32:10 +0000 (08:32 +0100)
login.php

index 2bd0d269208440e2dafa0b0528d6986db2c6ff05..577e5466bf05a95b76f7479557c2edc2b39cc0a1 100644 (file)
--- a/login.php
+++ b/login.php
 
 <body>
 
+<script type="text/javascript">
+function init() {
+
+       if (arguments.callee.done) return;
+       arguments.callee.done = true;           
+
+       var login = document.forms["loginForm"].login;
+
+       login.focus();
+
+}
+</script>
+
+<script type="text/javascript">
+if (document.addEventListener) {
+       document.addEventListener("DOMContentLoaded", init, null);
+}
+window.onload = init;
+</script>
+
 <table width='100%' height='100%' class="loginForm">
 
        <tr><td align='center' valign='middle'>
 
-       <form action="login.php" method="POST">
+       <form action="login.php" method="POST" name="loginForm">
        
        <table class="innerLoginForm">
 
 
 <? db_close($link); ?>
 
+<script type="text/javascript">
+       /* for IE */
+       function statechange() {
+               if (document.readyState == "interactive") init();
+       }
+
+       if (document.readyState) {      
+               if (document.readyState == "interactive" || document.readyState == "complete") {
+                       init();
+               } else {
+                       document.onreadystatechange = statechange;
+               }
+       }
+</script>
+
 </body>
 </html>