N
Nick Howes
This post isn't a question, but then newsgroups aren't Q&A forums (though
you'd be forgiven for thinking it)
If you have a form field such as a checkbox, and some text describing it
(and you probably do, or else it's just a mystery box), you may like to know
that there is a standard HTML tag to make it so clicking on the text checks
the box (which is so much easier than clicking on just that tiny little box
anyway). It's done using the <label> tag, and links to the field's id,
thusly:
<input type="checkbox" id="mybox" name="pool"/>
<label for="mybox">I play pool</label>
You can then click on the "I play pool" text to make the checkbox click. To
make it more obvious that the text can be clicked on, you can give <label>
tags some CSS styling so that the cursor changes to a hand, as it would over
a link:
<style type="text/css"><!--
label {
cursor: pointer;
cursor: hand;
}
--></script>
the two different cursors are needed so that it works in IE (which uses
hand) and others (which use pointer).
You can of course use labels for any other form field (on a text box,
clicking the label will put the text cursor in the box ready to type) If you
do this then all your web forms then they'll be so much more user-friendly
and easy to use, et cetera et cetera.
you'd be forgiven for thinking it)
If you have a form field such as a checkbox, and some text describing it
(and you probably do, or else it's just a mystery box), you may like to know
that there is a standard HTML tag to make it so clicking on the text checks
the box (which is so much easier than clicking on just that tiny little box
anyway). It's done using the <label> tag, and links to the field's id,
thusly:
<input type="checkbox" id="mybox" name="pool"/>
<label for="mybox">I play pool</label>
You can then click on the "I play pool" text to make the checkbox click. To
make it more obvious that the text can be clicked on, you can give <label>
tags some CSS styling so that the cursor changes to a hand, as it would over
a link:
<style type="text/css"><!--
label {
cursor: pointer;
cursor: hand;
}
--></script>
the two different cursors are needed so that it works in IE (which uses
hand) and others (which use pointer).
You can of course use labels for any other form field (on a text box,
clicking the label will put the text cursor in the box ready to type) If you
do this then all your web forms then they'll be so much more user-friendly
and easy to use, et cetera et cetera.