javascript不支持chrome和firfox任何解决方案 [英] javascript is not suppoerted in chrome and firfox any solution

查看:162
本文介绍了javascript不支持chrome和firfox任何解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<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>





这在Internet Explorer中起作用.在chrome和Firefox中不起作用.
任何解决方案





this is working in internet explorer.its not working in chrome and firefox.
any solution

推荐答案

resdiv是一个文本框,应使用值"属性在其中设置一些值.使用以下内容:

resdiv is a text box, you should use "value" property to set some value in it. use the following:

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);
           }

       }





只需检查一下resdiv是文本框,即可使用值"设置该值.


您说您已将div更改为文本框.那么您还必须更改属性.

最好的
Hi,


just check that resdiv is textbox so you''ve to set that values using "value"


you said you changed that div to textbox.then you''ve to change properties also.

All the Best


这篇关于javascript不支持chrome和firfox任何解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆