J
jhallbox
I am unclear how to test this object I'm sending to my function. It is
a cell in a table and I simply want to know which row it is in. I am
not a javascript programmer but a javascript cobbler, so illuminating
me about the proper terminology would be greatly appreciated as well...
The answer would allow me to simplify this (working) snippet. Thanks!
_________________________________________________________________________
<script language="JavaScript" type="text/JavaScript">
function popForm(which){
d=document.getElementById('lookup');
u=document.getElementById('update');
for(var i=0;i<d.rows.length;i++){
for(var j=0;j<d.rows.cells.length;j++){
if(d.rows.cells[j]==which){
d.rows.style.backgroundColor='#FFCC00';
for(var jj=0;jj<d.rows.cells.length;jj++){
u['c'+jj].value = d.rows.cells[jj].firstChild.nodeValue;
}
}
}
}
}
</script>
</head>
<body>
<table width="75%" border="1" id="lookup">
<tr><td colspan="3">Lookup Table</td></tr>
<tr>
<td onClick="popForm(this);">100</td>
<td>300</td>
<td>500</td>
</tr>
<tr><td colspan="3"> </td></tr>
</table>
<form method="post" action="" id="update">
<input type="text" name="a" id="c0">
<input type="text" name="b" id="c1">
<input type="text" name="c" id="c2">
</form>
</body>
</html>
a cell in a table and I simply want to know which row it is in. I am
not a javascript programmer but a javascript cobbler, so illuminating
me about the proper terminology would be greatly appreciated as well...
The answer would allow me to simplify this (working) snippet. Thanks!
_________________________________________________________________________
<script language="JavaScript" type="text/JavaScript">
function popForm(which){
d=document.getElementById('lookup');
u=document.getElementById('update');
for(var i=0;i<d.rows.length;i++){
for(var j=0;j<d.rows.cells.length;j++){
if(d.rows.cells[j]==which){
d.rows.style.backgroundColor='#FFCC00';
for(var jj=0;jj<d.rows.cells.length;jj++){
u['c'+jj].value = d.rows.cells[jj].firstChild.nodeValue;
}
}
}
}
}
</script>
</head>
<body>
<table width="75%" border="1" id="lookup">
<tr><td colspan="3">Lookup Table</td></tr>
<tr>
<td onClick="popForm(this);">100</td>
<td>300</td>
<td>500</td>
</tr>
<tr><td colspan="3"> </td></tr>
</table>
<form method="post" action="" id="update">
<input type="text" name="a" id="c0">
<input type="text" name="b" id="c1">
<input type="text" name="c" id="c2">
</form>
</body>
</html>