WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Adding a label to search box

for

From: Redazione non solo cms
Date: Apr 11, 2006 10:30AM


Peter Weil wrote:
> Emma,
>
> It's the input box that needs the label. You can add something like this:
>
> <div>
> <label for="s">Search this Site</label>
> <input type="text" name="s" id="s" />
> <input type="submit" id="searchsubmit" value="Go!" /
> </div>
Hi all, I had a similar "problem" for my blog site (using Wordpress just
like Emma)
and I added this html code:

<!-- BEGIN: search field -->
<fieldset id="search">
<label class="hidden" for="searchbutton">cerca</label>
<input id="searchbutton" type="image" src="http://www.duechiacchiere.it/wp-content/themes/duechiacchiere/img/icon_search.gif" name="submit" value="cerca" />
<label class="hidden" for="s">cerca:</label>
<input id="s" class="searchtext" type="text" name="s" size="13" value="cerca..."
onblur="if(this.value==') this.value='cerca...'; document.getElementById('s').style.backgroundColor = '#d6ccbf';"
onfocus="if(this.value=='cerca...') this.value='; document.getElementById('s').style.backgroundColor = '#fff';"
tabindex="10" />
</fieldset>

<!-- END: search field -->


http://www.duechiacchiere.it/

Is it correct?
Thanks in advance,
coolmann.