返回首页

<table>

        <tr>

            <td>

                <table>

                    <tr>

                        <td>

                            <table>

                                <tr>

                                    <td>

                                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="3"

                                            GridLines="None" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px"

                                            CellSpacing="1" >

                                            <Columns>

                                                <asp:TemplateField>

                                                    <ItemTemplate>

                                                        <input type ="checkbox" value="" onclick='addthis(this,<%#Eval("EmpSalary") %>)' />

 

                                                    </ItemTemplate>

                                                </asp:TemplateField>

                                                <asp:TemplateField HeaderText="Emp Salary">

                                                    <ItemTemplate>

                                                       <%# Eval("EmpSalary") %>

                                                    </ItemTemplate>

                                                </asp:TemplateField>

                                            </Columns>

                                            <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />

                                            <RowStyle BackColor="#DEDFDE" ForeColor="Black" />

                                            <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />

                                            <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />

                                            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />

                                        </asp:GridView>

                                        <input type="text" id="resdiv" value="0" />

                                        <asp:Button ID="bbbtbn" runat="server" Width="50px" onclick="bbbtbn_Click" />

 



                                    </td>

                                </tr>

                            </table>

 

                        </td>

                    </tr>

                </table>

            </td>

        </tr>

    </table>

    <script type="text/javascript">

 

        function addthis(tid, val1) {

            if (tid.checked) {

                document.getElementById("resdiv").innerText = parseInt(document.getElementById("resdiv").value) + parseInt(val1);

 



            }

            else {

                document.getElementById("resdiv").innerText = parseInt(document.getElementById("resdiv").value) - parseInt(val1);

            }

 

        }

 



    </script>


这是工作不工作在Chrome和Firefox在互联网explorer.its。
任何解决方案

回答

评论会员:赛尼阿伦 时间:2012/02/06
resdiv是一个文本框,你应该使用"值"属性设置一定的价值。使用以下命令:

function addthis(tid, val1) {

           if (tid.checked) {

               document.getElementById("resdiv").value = parseInt(document.getElementById("resdiv").value) + parseInt(val1);

 



           }

           else {

               document.getElementById("resdiv").value = parseInt(document.getElementById("resdiv").value) - parseInt(val1);

           }

 

       }
评论会员:游客 时间:2012/02/06
Muralikrishna8811:嗨,只是检查,resdiv是文本框,所以你设置值"值"你说你改变了该div,以textbox.then你也改变属性。最佳