Here's a quick & dirty method, but it should at least point you in the right direction:
HTML:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sample Form</title>
<script type="text/javascript" src="label.js"></script>
</head>
<body>
<div id="wrapper">
<form action="#">
<label for="fname" id="label1" style="color:#000000;">First Name:</label> <input type="text" id="fname" onFocus="changeLabel(1); ">
<br>
<label for="lname" id="label2" style="color:#000000;">Last Name:</label> <input type="text" id="lname" onFocus="changeLabel(2);">
</form>
</div>
</body>
</html>
JS (label.js):
Code:
function changeLabel(i) {
var newColor = document.getElementById("wrapper");
if (i == 1) {
document.getElementById("label1").style.color = "#C00000";
}
else {
document.getElementById("label1").style.color = "#000000";
}
if (i == 2) {
document.getElementById("label2").style.color = "#C00000";
}
else {
document.getElementById("label2").style.color = "#000000";
}
}
Obviously you can choose whatever colors you want, and even apply additional styling (bold, etc.) as desired.