...

View Full Version : trying to highlight row color onchange



nikko50
01-01-2011, 09:17 PM
I'm trying to highlight the row color when the input field is changed but get an error. Can someone please help. TRACY:(


<script type="text/javascript">
function toggle(trid){
var edited_row_bgcolor = '#FAEBD7';
var elm = document.getElementById(trid);
document.elm.style.background = edited_row_bgcolor;
}


</script>



<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr id="Child1">
<td width="50%">
<input onchange="toggle('Child1');" type="text" name="T1" size="20">
</td>
<td width="50%"></td>
</tr>
<tr>
<td width="50%"><input type="text" name="T1" size="20"></td>
<td width="50%"></td>
</tr>
<tr>
<td width="50%"><input type="text" name="T1" size="20"></td>
<td width="50%"></td>
</tr>
<tr>
<td width="50%"><input type="text" name="T1" size="20"></td>
<td width="50%"></td>
</tr>
<tr>
<td width="50%"><input type="text" name="T1" size="20"></td>
<td width="50%"></td>
</tr>
</table>

vwphillips
01-02-2011, 09:27 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script type="text/javascript">
function toggle(trid){
var edited_row_bgcolor = '#FF3366';
var elm = document.getElementById(trid);
elm.style.backgroundColor = edited_row_bgcolor;
}
</script>
</head>

<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr id="Child1">
<td width="50%">
<input onchange="toggle('Child1');" type="text" name="T1" size="20">
</td>
<td width="50%">55</td>
</tr>
<tr>
<td width="50%"><input type="text" name="T1" size="20"></td>
<td width="50%"></td>
</tr>
<tr>
<td width="50%"><input type="text" name="T1" size="20"></td>
<td width="50%"></td>
</tr>
<tr>
<td width="50%"><input type="text" name="T1" size="20"></td>
<td width="50%"></td>
</tr>
<tr>
<td width="50%"><input type="text" name="T1" size="20"></td>
<td width="50%"></td>
</tr>
</table>
</body>

</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum