473,791 Members | 2,995 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Making default entry in search text box disappear on click

Hi All

How do I make it so that when a user clicks in a search text field, the
default entry (in this case "Search") is removed automatically - they
are then faced with a blank search box and can type straight away

Thanks in advance

Jul 24 '05
36 72095
Philip Ronan wrote:

But from my experience
most browsers select the contents of text boxes when they receive focus.
I don't know of any browsers that automatically select the entire
contents of a text box unless the user tabbed to the field. A single
mouse click doesn't do it, for sure.
If
not, then the user just has to hold the key down a bit longer until the
auto-repeat kicks in. Or if the user is really pressed for time, perhaps
control+delete might do it, or (gasp) control-A, delete. This isn't really a
big deal.


Not a big deal to you, obviously. For the rest of us, it is an annoyance
to some and just plain confusing to others. In either case, it's rude to
make your visitors work to use your site.
So what's the problem?


The problem seems to be your lack of consideration to your visitors.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Jul 24 '05 #31
Philip Ronan <in*****@invali d.invalid> wrote:
A user behaviour study [1] that I helped to set up and conduct clearly
showed that most users are lost when there is no submit button. Even
amongst computer literate under 35's the percentage was quite high.
Fair enough. But if we're talking about a search box that appears on every
page of a website I'm sure people will soon figure out what it's for.


This wasn't an issue, all cases were appropriately labeled.
Did the buttonless search box in your study have any initial content?


The value of place-holding text [1] was tested separately using forms
with submit buttons. It helped somewhat to convey the function of the
various fields for some user groups (55+ and computer novices mainly).
On the other hand in a significant number of cases the place-holding
text was left in place by those same users. The use of client side
scripting to clear the place-holding text would help to reduce the
latter problem.

[1]
http://www.w3.org/TR/1999/WAI-WEBCON...-place-holders

--
Spartanicus
Jul 24 '05 #32
"Darin McGrew" wrote:
The example in the HTML 4 spec is not--nor was it intended to be--a good
example of an HTML form.
Is that a fact, or an opinion?
Other forms shown in the HTML 4 spec, which are intended to be good
examples of an HTML form, do include submit buttons.


It is still nevertheless the case that the submit button is *optional* in
forms with a single text field.

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/
Jul 24 '05 #33
"kchayka" wrote:
I don't know of any browsers that automatically select the entire
contents of a text box unless the user tabbed to the field. A single
mouse click doesn't do it, for sure.
Obviously I don't know what browser you're using. Maybe a double click will
work?
The problem seems to be your lack of consideration to your visitors.


There's more than one way to skin a cat. I'm not claiming this is the *best*
way of doing things. It's just *a* way of doing things. It has drawbacks as
well as benefits. But it works. For everybody.

Obviously I wouldn't use it on a website where Javascript-disabled visitors
would be liable to fly into a confused rage at having one second of their
time wasted.

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/
Jul 24 '05 #34
JRS: In article <Pi************ *************** ****@ppepc56.ph .gla.ac.uk
, dated Wed, 6 Jul 2005 13:40:19, seen in news:comp.infos ystems.www.aut

horing.html, Alan J. Flavell <fl*****@ph.gla .ac.uk> posted :
So ... you're saying that web designers should never use Javascript on the
WWW,


No, I'm not saying that. I'm saying that the design should never
*rely* on javascript being successfully executed. Using it to provide
optional extra conveniences is perfectly fine.


That's rather a blinkered attitude.

It applies to web pages that are used to send data to a server, in which
case a properly-designed page will be usable without script.

It does not apply to pages such as <URL:http://www.merlyn.demon.co.uk/as
tron-3.htm>, the purpose of which is to deliver calculators to the user,
calculators which require no post-delivery service from the server, and
which can be used on- or off- line. (( In this case, there is *no*
possibility of doing the calculations at the serving establishment. ))

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 24 '05 #35
On Thu, 7 Jul 2005, Dr John Stockton wrote:
No, I'm not saying that. I'm saying that the design should never
*rely* on javascript being successfully executed. Using it to provide
optional extra conveniences is perfectly fine.
That's rather a blinkered attitude.


On the contrary, it's not only in accord with the principles of the
WAI, but it offers the optional conveniences to all who have consented
or are willing to consent to executing js, while still offering basic
functionality to everyone else. I can't see why you'd feel you need
to object to that.
It does not apply to pages such as
<URL:http://www.merlyn.demon.co.uk/as tron-3.htm>, the purpose of
which is to deliver calculators to the user, calculators which
require no post-delivery service from the server, and which can be
used on- or off- line. (( In this case, there is *no* possibility of
doing the calculations at the serving establishment. ))


I would have to rate that as an "optional extra convenience", not
essential to the "design of the page" in the terms of my quoted
objection. Although it understandably doesn't actually work, this
page could be successfully viewed without js enabled, if it were not
for this piece of unrelated drivel:

Some of this page needs a compatible Symbol font, in which for example
p is displayed as the Greek letter pi and Ö as Root; otherwise,
letters may be displayed in place of Greeks and Maths signs.

Displaying the letters is *correct*, and has been throughout the life
of HTML, although it wasn't till around 1995 that the issue was first
pointed out, it seems. Displaying anything else is a browser bug,
which is slowly getting repaired, and it is foolish to rely on a
browser bug, and additionally foolish to explicitly ask one's users to
rely on such a bug.

You'd do well to phase this rubbish out without delay, in favour of
standards-conforming character representation. A.Prilop will be along
any moment to pour appropriate scorn...
But to come back to your point:

There's certainly an argument to be made that executing a js that has
been stored locally could be less of a risk than allowing a web page
to execute js directly. Indeed "bookmarkle ts" (aka "favelets") work
on just that principle.

have fun
Jul 24 '05 #36
JRS: In article <Pi************ *************** ****@ppepc56.ph .gla.ac.uk
, dated Thu, 7 Jul 2005 20:50:57, seen in news:comp.infos ystems.www.aut horing.html, Alan J. Flavell <fl*****@ph.gla .ac.uk> posted :On Thu, 7 Jul 2005, Dr John Stockton wrote:
>No, I'm not saying that. I'm saying that the design should never
>*rely* on javascript being successfully executed. Using it to provide
>optional extra conveniences is perfectly fine.
That's rather a blinkered attitude.


On the contrary, it's not only in accord with the principles of the
WAI, but it offers the optional conveniences to all who have consented
or are willing to consent to executing js, while still offering basic
functionalit y to everyone else. I can't see why you'd feel you need
to object to that.


Because they are not optional extra conveniences, but are the whole
purpose of the page. With script not enabled, the page is rather like a
calculator without its battery - it may be interesting to look at, one
can see what it does, but one cannot *use* it.

In that page, I offer no functionality to those without javascript; I
just let them realise what they are not getting.

It does not apply to pages such as
<URL:http://www.merlyn.demon.co.uk/as tron-3.htm>, the purpose of
which is to deliver calculators to the user, calculators which
require no post-delivery service from the server, and which can be
used on- or off- line. (( In this case, there is *no* possibility of
doing the calculations at the serving establishment. ))


I would have to rate that as an "optional extra convenience", not
essential to the "design of the page" in the terms of my quoted
objection. Although it understandably doesn't actually work, this
page could be successfully viewed without js enabled, if it were not
for this piece of unrelated drivel:

Some of this page needs a compatible Symbol font, in which for example
p is displayed as the Greek letter pi and Ö as Root; otherwise,
letters may be displayed in place of Greeks and Maths signs.


But the page is not intended to be viewed; that is a mere essential
ancillary. It is intended to be executed.
Displaying the letters is *correct*, and has been throughout the life
of HTML, although it wasn't till around 1995 that the issue was first
pointed out, it seems. Displaying anything else is a browser bug,
which is slowly getting repaired, and it is foolish to rely on a
browser bug, and additionally foolish to explicitly ask one's users to
rely on such a bug.

You'd do well to phase this rubbish out without delay, in favour of
standards-conforming character representation. A.Prilop will be along
any moment to pour appropriate scorn...
He should have more sense, and remember that the matter has already been
discussed. I prefer to use characters that I can read as desired, and
that most readers see as I desire, to ones that I cannot see as I wish.
It's quite important to readers that authors can follow their own work.

I should instead have referenced <URL:http://www.merlyn.demon.co.uk/js-
clndr.htm#Ctrls >, which shows only US-keyboard characters. Or
..../holidays.htm which now *requires* script to be of much use, since
I'm unwilling to update the old non-script version each year. BTW, you
might like to check the Scotland holidays.
But to come back to your point:

There's certainly an argument to be made that executing a js that has
been stored locally could be less of a risk than allowing a web page
to execute js directly.


That, whilst no doubt a valid argument, was *not* my point, which was
that local execution can be more convenient for those without permanent
connection to the Net.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 24 '05 #37

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3169
by: shantibhushan | last post by:
Hi buddy I have to highlight search text from search results as it is in google or alibaba.com. e.g. if I input paper as a searchtext in search results paper word should be highlighted. as it isin google help. some one help me please. I am working in asp.net2.0 using c# Regards,
0
957
by: Ivica Muruzovic | last post by:
How can I use previous typed search text in google search box or any other web browser. I have combobox and want to fill him with that previous typed search text on local machine
4
6843
by: sangam56 | last post by:
Hi all. I have an iframe in an asp.net web page (Display.aspx). <iframe id="iframe1" runat="server" src="temp/test.html"></iframe> Now I need to highlight a search text, say 'test' in the Display.aspx page. The source of iframe is dynamically assigned and search text is also changeable. This means I am dealing with dynamic search text and html page. Please suggest me how could I highlight the search texts in the iframe placed in the...
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10427
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10207
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9995
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9029
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.