HTML + CSS

From Blue-IT.org Wiki

Input field with caption

The caption disapears on focus:

<input type="Text" 
value=" bitte den Suchtext hier eingeben " 
onfocus="this.value=;"
>

In Drupal 7 search module this looks like this:

/** LINE 1003 FF of modules/search/search.module
 *
 * Form builder; Output a search form for the search block's search box.
 *
 * @ingroup forms
 * @see search_box_form_submit()
 * @see search-theme-form.tpl.php
 * @see search-block-form.tpl.php
 */
function search_box($form, &$form_state, $form_id) {
  $form[$form_id] = array(
    '#type' => 'textfield',
    '#title' => t('Search'),
    '#title_display' => 'invisible',
    '#size' => 15,
    '#default_value' => ,
    '#attributes' => array('title' => t('Enter the terms you wish to search for.'), 'value' => t('Search'), 'onfocus' => 'this.value="";'),
  );
  $form['actions'] = array('#type' => 'actions');
  $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Search'));
  $form['#submit'][] = 'search_box_form_submit'; 

  return $form;
}