Diane wrote:
> Is there a way to internally display the text box label in a text box
> that does not otherwise hold data?
Bj suggested:
You could try something easy like
<input type=text size=20 title="Name of City">
...which should make a small "tooltip" box containing "Name of City" pop
up when the cursor is moved over the field
Or you could try some fiendish JavaScript like this. The text box is
initally set to readonly (which would gray out the contents) and when
user clicks in the box you detect this with an onFocus event that clears
the content and removes the readonly/disabled attribute to allow
editing:
<script>
function clearit() {
document.form.textbox.readonly=false;
document.form.textbox.value="";
}
</script>
...
<input type="text" name="textbox" size="20"
title="Test input" readonly value="Name of City" onFocus="clearit();">
You could go a bit further and have an onBlur to check if anything was
put in the box, and put back the initial value and readonly attribute if
not....
Tim adds:
Of course, the readonly and title stuff only works in IE - and a
readonly field will be skipped in the tab order. Another way, if you're
using a database, would be to just use the default value you want
displayed as the default database field value (presuming you're loading
the page from a database in the first place). If you are in fact only
supporting IE, you could combine defining expando properties for the
text fields and have a JavaScript loop through the page's text controls
and place the extra property as the field value, and take care of
non-entries using onBlur like Bj suggested. If you're supporting
Netscape 4.x things get a little more complicated, but there's ways to
do it for that, too.
Tim
___________________________
Tim Furry
Web Developer
Foulston Siefkin LLP
____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]