Forum Moderators: not2easy
Hi Everyone -
I am creating a data entry form and would like
to change the background color of the textbox when
the textbox becomes active, and change the color
back to white when the focus is moved from the
textbox....
I have the CSS setup - i am just not sure
on how to change the background when the
textbox receives focus...
(inline code please)
please advise
thanks
tony
Welcome to these forums ;)
Try this...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>onfocus~onblur</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
</head>
<body>
<form action="">
<div>
<textarea rows="5" cols="20" onfocus="this.style.backgroundColor='#ff0000'"
onblur="this.style.backgroundColor=''"></textarea>
</div>
</form>
</body>
</html>
birdbrain