Inline user_login focus JS and avoid JS error. Props azaozz. fixes #7282

git-svn-id: http://svn.automattic.com/wordpress/trunk@8314 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-07-11 20:14:44 +00:00
parent 752b0eb45b
commit 8ae2545c47
1 changed files with 11 additions and 9 deletions

View File

@ -53,14 +53,7 @@ function login_header($title = 'Login', $message = '', $wp_error = '') {
<?php
wp_admin_css( 'login', true );
wp_admin_css( 'colors-fresh', true );
?>
<script type="text/javascript">
function focusit() {
document.getElementById('user_login').focus();
}
window.onload = focusit;
</script>
<?php do_action('login_head'); ?>
do_action('login_head'); ?>
</head>
<body class="login">
@ -334,6 +327,9 @@ case 'retrievepassword' :
<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
<script type="text/javascript">
try{document.getElementById('user_login').focus();}catch(e){}
</script>
</body>
</html>
<?php
@ -399,6 +395,9 @@ case 'register' :
<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
<script type="text/javascript">
try{document.getElementById('user_login').focus();}catch(e){}
</script>
</body>
</html>
<?php
@ -481,10 +480,13 @@ default:
<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
<script type="text/javascript">
try{document.getElementById('user_login').focus();}catch(e){}
</script>
</body>
</html>
<?php
break;
} // end action switch
?>
?>