DelphiFAQ Home Search:
General :: Web publishing :: JavaScript
Code snippets to add functionality to your HTML pages, preferably cross-browser.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

How to focus on an input field when the page is loaded

The object model provides a .focus() method.
Simply reference the field and call its focus method in the onload event as shown below:

<body onload="document.getElementById('searchterm').focus();">
 
 // .. here's the FORM. Make sure to define the ID tag,
 // not just the name tag.
 <textarea id="searchterm">

Generated 4:02:04 on Sep 22, 2018