Forum Moderators: open
<html><body>
<form name='myform'>
<table cellpadding='10' border='1'>
<tr id='row1'><td><input type='text' onfocus='javascript:setbg(row1);'></td></tr>
<tr id='row2'><td><input type='text' onfocus='javascript:setbg(row2);'></td></tr>
<tr id='row3'><td><input type='text' onfocus='javascript:setbg(row3);'></td></tr>
</table>
</form>
<script type='text/javascript'>
var bg1 = "#ccffcc";
var bg2 = "#ffcccc";
function clearall()
{
document.all.row1.style.backgroundColor = bg1;document.all.row2.style.backgroundColor = bg1;
document.all.row3.style.backgroundColor = bg1;
}function setbg(row)
{
clearall();
row.style.backgroundColor = bg2;
}clearall();
</script>
</body>
</html>
<script type='text/javascript'>
function display(value)
{
var displaybg="row"+value;
var displaybg=document.getElementById(displaybg);
displaybg.style.backgroundColor="#efefef";
}
function remove(value)
{
var removebg="row"+value;
var removebg=document.getElementById(removebg);
removebg.style.backgroundColor="#ffffff";
}
</script>
<form>
<table>
<tr id="row1">
<td><input type="text" name="name" onFocus="javascript:display(1);" onBlur="javascript:remove(1);"></td>
</tr>
</table>