在script中获取页面结果集表格中的数据

var main=mygrid.gettable("11");  //表示获取非固定列的表格    

var main1=mygrid.gettable("01");//表示获取固定列的表格 

    ///var quantity= mygridgetcolnumber(0,"quantity");

    //var per_quantity= mygridgetcolnumber(0,"per_quantity");

    var planquantity= mygridgetcolnumber(0,"planquantity");

var lastcount= mygridgetcolnumber(0,"lastcount");

//得到lastcount对应的列数,在第几列上面

    alert(lastcount)

    ///var goodspack= mygridgetcolnumber(0,"goodspack");

   // var contract_code= mygridgetcolnumber(0,"contract_code");

    ///var zy_code= mygridgetcolnumber(0,"zy_code");

alert(mygrid.gettable("11").rows.length+"===")

//获取表格的行数

    if(mygrid.gettable("11").rows.length>0){

        for(var i=0;i<=mygrid.gettable("11").rows.length-2;i++){   

Var planquantity2=main.rows(i).cells(planquantity).childNodes[0].value;//获取input类型的列名为planquantity的各行的值

            alert(planquantity2);

Var lastcount2=main.rows(i).cells(lastcount).innerText; 

//获取label类型的列名为lastcount的各行的值

//main.rows(i).cells(lastcount).childNodes[0].value;

            alert(lastcount2);

            if(planquantity2 > lastcount2){

                //alert("请输入数量(担)!");

                alert("输入数量(担)不能超过剩余量!");

                main.rows(i).cells(planquantity).childNodes[0].focus();

                return;

            }

            return;

        }

    }

  

你可能感兴趣的:(script)