Friday, 23 May 2008
To set the focus of a HTML text box include this short piece of code in the <head> section
<script>function setfoc() { document.f1.KeyWords.focus(); }
In the example above f1 is the name of the form and KeyWords is the name of the input textbox
In the body section:
<form name="f1" action="youraction" method="POST">
<input type="text" name="KeyWords" size="40" value="default text">
</form>
<script language="JavaScript">setfoc();</script>
Related
- How to enable Javascript on IE and get a smile from your users
- Ideas for a new common programming language
- PHP: Encoding HTML Special Characters
- Power Shell
- Java: Mix up items in array



[...] tagged javascriptOwn a WordPress blog? Make monetization easier with the WP Affiliate Pro plugin. Javascript: Set Focus of HTML Textbox saved by 2 others XzxJaNxzX bookmarked on 05/24/08 | [...]