写一个jquery效果,要实现的目的如下:
修改每个人的基数后,养老保险变成 修改后的基数*0.2;
部分HTML代码如下:
<TABLE id=GridView1 style="BORDER-RIGHT: white 1px ridge; BORDER-TOP: white 1px ridge; BORDER-LEFT: white 1px ridge; BORDER-BOTTOM: white 1px ridge; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=3 rules=all border=1>
<TR style="FONT-WEIGHT: bold; COLOR: white; BACKGROUND-COLOR: #476d90">
<TH scope=col>姓名</TH>
<TH scope=col>基数</TH>
<TH scope=col>比例</TH>
<TH scope=col>起始月份</TH>
<TH scope=col>结束月份</TH>
<TH scope=col>管理费</TH>
<TH scope=col>养老保险</TH>
<TH scope=col>医疗保险</TH>
<TH scope=col>失业保险</TH>
<TH scope=col>工伤保险</TH>
<TH scope=col>生育保险</TH>
<TH scope=col>公积金</TH>
<TH scope=col>合计</TH></TR>
<TR style="COLOR: #000066">
<TD> 卜兆多 </TD>
<TD><INPUT id=GridView1_ctl02_TextBox2 style="WIDTH: 65px" value=2000 name=GridView1$ctl02$TextBox2> </TD>
<TD><SELECT id=GridView1_ctl02_DropDownList1 name=GridView1$ctl02$DropDownList1> <OPTION value=8 selected>1374</OPTION> <OPTION value=4>1296</OPTION></SELECT> </TD>
<TD><INPUT id=GridView1_ctl02_TextBox3 style="WIDTH: 80px" value=2010-9-2 name=GridView1$ctl02$TextBox3> </TD>
<TD><INPUT id=GridView1_ctl02_TextBox4 style="WIDTH: 80px" value=2010-9-1 name=GridView1$ctl02$TextBox4> </TD>
<TD><INPUT id=GridView1_ctl02_TextBox5 style="WIDTH: 65px" value=40 name=GridView1$ctl02$TextBox5> </TD>
<TD><INPUT id=GridView1_ctl02_TextBox6 style="WIDTH: 65px" value=480 name=GridView1$ctl02$TextBox6> </TD>
<TD><INPUT id=GridView1_ctl02_TextBox7 style="WIDTH: 65px" value=182 name=GridView1$ctl02$TextBox7> </TD>
<TD><INPUT id=GridView1_ctl02_TextBox8 style="WIDTH: 65px" value=60 name=GridView1$ctl02$TextBox8> </TD>
<TD><INPUT id=GridView1_ctl02_TextBox9 style="WIDTH: 65px" value=20 name=GridView1$ctl02$TextBox9> </TD>
<TD><INPUT id=GridView1_ctl02_TextBox10 style="WIDTH: 65px" value=12 name=GridView1$ctl02$TextBox10> </TD>
<TD><INPUT id=GridV
用JQuery 查找所有行,得到行的集合、
再遍历集合、查找 养老保险对应 列 里面的控件,设置控件的值;就OK,
var grids = $("#GridView1");
for (var i = 1; i < grid[0].rows.length; i++) {
var obj=grid[0].rows[i].cells[6].getElementsByTagName("INPUT")[0];
obj.value=obj.value * 1.2;
}