日期:2014-05-18 浏览次数:20513 次
<form id="form1" runat="server">
<table style="width: 100%;">
<tr>
<td>
<input id="Checkbox1" name="chk" type="checkbox" onclick="return changeText();"/>
</td>
<td>
<input id="Text1" name="txt" type="text" />
</td>
<td>
<input id="Checkbox2" name="chk" type="checkbox" onclick="return changeText();"/>
</td>
<td>
<input id="Text2" name="txt" type="text" />
</td>
</tr>
<tr>
<td>
<input id="Checkbox3" name="chk" type="checkbox" onclick="return changeText();"/>
</td>
<td>
<input id="Text3" name="txt" type="text" />
</td>
<td>
<input id="Checkbox4" name="chk" type="checkbox" onclick="return changeText();"/>
</td>
<td>
<input id="Text4" name="txt" type="text" />
</td>
</tr>
<tr>
<td>
<input id="Checkbox5" name="chk" type="checkbox" onclick="return changeText();"/>
</td>
<td>
<input id="Text5" name="txt" type="text" />
</td>
<td>
<input id="Checkbox6" name="chk" type="checkbox" onclick="return changeText();"/>
</td>
<td>
<input id="Text6" name="txt" type="text" />
</td>
</tr>
</table>
</form>
<script type="text/javascript">
var i=1;
function changeText()
{
var obj=event.srcElement
if(obj.checked)
{
obj.parentElement.nextSibling.firstChild.innerText=i;
i++;
}
else
{
var k=parseInt(obj.parentElement.nextSibling.firstChild.value);
obj.parentElement.nextSibling.firstChild.innerText="";
i--;
&n