Quick Suggestion
| From: | David Duong | Date: | Wed, 05 May 2004 23:16:26 +0000 |
| Subject: | Quick Suggestion | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-24552@lists.php.net to get a copy of this message | ||
Hi,
I have a suggestion for any webmaster at php.net. I just found out
about the keyboard shortcut (alt+s) and thought that it would be easier
to just give focus to the search box immediately when the page is
loaded. It would allow visitors (me) with JavaScript support to just
enter their search immediately after the page loads w/o having to press
alt+s, or having to click on the search box.
Just give your form a name (frmsearch) and add this code after the
search box.
<script>
<!--
document.frmsearch.pattern.focus()
// -->
</script>
But it may be better to do what Google does:
<head>
.
<script>
<!--
function sf() {document.f.q.focus();} // f is the form name, q is the
search box name
// -->
</script>
.
</head>
<body onLoad=sf()>
.
David Duong