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
*