页面方法在IE中运行良好,但在Google Chrome和Firefox中没有 [英] Page method works fine in IE but not in Google chrome and Firefox

查看:140
本文介绍了页面方法在IE中运行良好,但在Google Chrome和Firefox中没有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我写了一个功能,包括一个页面方法,在IE浏览器中工作正常但在谷歌浏览器和Firefox中没有...

下面是我的代码

Hello I write one function includes one page method which is working fine in IE but not in google chrome and Firefox..
Below is my code

<script type="text/javascript">
        function TestScriprt(query) {
            var strQuery = query;
           
            //Stop post back to server
            var table, tbody, i, rowLen, row, j, colLen, cell, cell1;
            var colArray = new Array();
            var rowArray = new Array();
            table = document.getElementById("<%=GrdDynamic.ClientID %>");
         


            tbody = table.tBodies[0];

            for (i = 0, rowLen = tbody.rows.length; i < rowLen; i++) {

                row = tbody.rows[i];
                for (j = 0, colLen = row.cells.length; j < colLen; j++) {
                    cell1 = row.cells[j];
                    cell = table.rows[i].cells[j].childNodes[0].innerHTML;
                    var cell2 = table.rows[i].cells[j].childNodes[0].value;

                    if (i == 0) {
                       
                        colArray[j] = new Array();
                        colArray[j] = cell;
                        //alert("colArray[" + j + "]" + colArray[j]);
                    }
                    else if (i > 0) {
                        // Age
                        //alert("--Found age: " + cell1.innerHTML);
                        if (j < 2) {
                            rowArray[j] = new Array();
                            rowArray[j] = cell;
                            //alert("rowArray[" + j + "]" + rowArray[j]);
                        }
                        else {
                            rowArray[j] = new Array();
                            rowArray[j] = cell2;
                           
                        }
                    }
                }

                if (i > 0) {
                    PageMethods.ProcessIT(colArray, rowArray, strQuery, onSucess, onError);

                    function onSucess(result) {
                        //alert(result);
                    }
                    function onError(result) {
                        //alert('Something wrong.');
                    }
                }                      
            }
         

           
            return false;
}
</script>




[WebMethod]
    public static string ProcessIT(string[] colArr, string[] rowArr,string query)
    {
    
        int k = 0;
        type = "";
        Sal = 0;
        totSal = 0;
        id = 0;
        for (int i = 0; i < colArr.Length; i++)
        {
            name = rowArr[0];
            empId =Convert.ToInt64( rowArr[1]);

            if (i >= 2)
            {
                if (k ==0)
                {
                    for (int j = 2; j <= addColCount+1; j++)
                    {
                        string colName = colArr[j];
                        getAddSalCompIDType(colName, rowArr[j],rowArr[colArr.Length-1]);
                        salGen = new Salary_Generation();
                        salGen.customer_Id = customerId;
                        salGen.date = date;
                        salGen.Emp_id = empId;
                        salGen.Sal_cat_type = type;
                        salGen.sal_toatal = totSal;
                        salGen.Salary = Sal;
                        salGen.user_Id = userId;
                        salGen.Salary_Comp_Id = id;
                        if (query == "insert")
                        {
                            string res = salGen.InsertSalaryGeneration(salGen);
                        }
                        else if (query == "update")
                        {
                            string res = salGen.UpdateSalaryGeneration(salGen);
                        }
                        else
                        {
                            string res = salGen.DeleteSalaryGeneration(salGen);
                        }
                    }
                }

                else if(k==1)
                {
                    for (int j = 2 + addColCount; j <= colArr.Length - 2; j++)
                    {
                        string colName = colArr[j];
                        getDedSalCompIDType(colName,rowArr[j], rowArr[colArr.Length - 1]);
                        salGen = new Salary_Generation();
                        salGen.customer_Id = customerId;
                        salGen.date = date;
                        salGen.Emp_id = empId;
                        salGen.Sal_cat_type = type;
                        salGen.sal_toatal = totSal;
                        salGen.Salary = Sal;
                        salGen.user_Id = userId;
                        salGen.Salary_Comp_Id = id;

                        if (query == "insert")
                        {
                            string res = salGen.InsertSalaryGeneration(salGen);
                        }
                          else if(query == "update")
                        {
                            string res = salGen.UpdateSalaryGeneration(salGen);
                        }
                        else
                        {
                            string res = salGen.DeleteSalaryGeneration(salGen);
                        }
                    }
                }
                k++;
            }
        }
       
        return "result";
    }

推荐答案

这篇关于页面方法在IE中运行良好,但在Google Chrome和Firefox中没有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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