You are here: Re: Default input « HTML « IT news, forums, messages
Re: Default input

Posted by Jukka K. Korpela on 05/08/06 08:16

Zack wrote:

> How do I set an input to be default?

Normally your question would be answered by saying that you specify the
default value for a text input field in the value="..." attribute.

> I have a search engine but to input
> boxes above it and would like search box selected by default.

Apparently, you meant to ask how to make a text input field _focused_
when a page is entered.

The short answer is: Don't.

The longer answer is: You shouldn't, because the user may enter some
input into the field _before_ your client-side script manages to focus
on it. (There's no other way to focus on it than client-side scripting.)
Now imagine yourself typing "foobar" and having just "bar" entered,
since after you had typed "foo", the field was focused, thereby
selecting the text in it, and then the characters "bar" _replaced_ the
old content.

If you _still_ want to do that, use the JavaScript function onfocus(),
see http://www.cs.tut.fi/~jkorpela/forms/javascript.html#focus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация