[WSG] CSS version of onfocus onblur for form fields

2004-04-19 Thread Paul Ross
Hello folks,

Does anyone know if there is a CSS equivalent of onfocus and onblur? I 
have a homepage with 2 input boxes - one with the initial value called 
'Username' and the other called  'Password'  (which shows up as  
on screen). If I am not making myself clear here's the page in question: 
http://www.informprint.com

What I would like is the user to click on the input box labelled 
'Username' and the initial value then disappears and is replaced by 
whatever the customer is typing. Same for the password field. I have 
read how I can do this using the JavaScript onfocus and onblur commands 
but was wondering if there was a better, more accessible (?) way using 
just CSS.

Regards
PAUL ROSS
SkyRocket Design Co
*
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
* 



Re: [WSG] CSS version of onfocus onblur for form fields

2004-04-19 Thread Justin French
On 20/04/2004, at 11:49 AM, Paul Ross wrote:

Hello folks,

Does anyone know if there is a CSS equivalent of onfocus and onblur?
There is a CSS pseudo selector :focus
http://www.w3.org/TR/CSS2/selector.html#x33
I have a homepage with 2 input boxes - one with the initial value 
called 'Username' and the other called  'Password'  (which shows up as 
 on screen).

What I would like is the user to click on the input box labelled 
'Username' and the initial value then disappears and is replaced by 
whatever the customer is typing. Same for the password field. I have 
read how I can do this using the JavaScript onfocus and onblur 
commands but was wondering if there was a better, more accessible (?) 
way using just CSS.
Sorry, that's a JS job, not a CSS job.

If you're going to do it at all, I'd use JS to SET the default on body 
load AND remove the default on focus, so that non-JS users are not 
inconvenienced by having to select and delete the text.

Better still, don't do it, because it changes the behaviour of the 
browser.  People expect that they'll have to select+delete existing 
text, because that's what USUALLY happens.  Changing this behaviour 
seems like bad usability 101 to me.

---
Justin French
http://indent.com.au
*
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
*