81,092
社区成员
发帖
与我相关
我的任务
分享
<html>
<script language=javascript>
function RecoverColor(sign)
{
var CellName= event.srcElement.name;
var CellId= event.srcElement.id;
var CellArry;
var InputArry;
CellArry=document.getElementsByName(CellName);
InputArry=document.getElementsByName("inp_t");
alert("获得TD个数为:" + CellArry.length);//这里的个数是0
alert("Input个数为:" + InputArry.length)//这里的个数是5
if(sign=="Y")
CellArry[0].style.backgroundColor='#3fd561f';
}
</script>
<body>
<table border="1" height="94">
<tr>
<td height="30" width="104" id="1" name="ydsw" ondblclick="RecoverColor('d')">
月度事务1</td>
<td height="30" width="91" id="1" name="qntq" ondblclick="RecoverColor('d')">
去年同期1</td>
</tr>
<tr>
<td height="26" width="104" id="2" name="ydsw" ondblclick="RecoverColor('d')">
月度事务2</td>
<td height="26" width="91" id="2" name="qntq" ondblclick="RecoverColor('d')">
去年同期2</td>
</tr>
<tr>
<td height="28" width="104" id="3" name="ydsw" ondblclick="RecoverColor('d')">
月度事务3</td>
<td height="28" width="91" id="3" name="qntq" ondblclick="RecoverColor('d')">
去年同期3</td>
</tr>
</table>
<p> </p>
<input type=text name="inp_t" value=input_1>
<input type=text name="inp_t" value=input_2>
<input type=text name="inp_t" value=input_3>
<input type=text name="inp_t" value=input_4>
<input type=text name="inp_t" value=input_5>
</body>
</html>