js非空验证

  1. click:function(){ 
  2.            var updateinfo;  //定义一个数组 用来存储被修改过得信息   
  3.                for( var i = 0; i <34; i++,i++){ 
  4.                  var j = updatelineform.getItems()[i+1].getValue();//获取对应的value 
  5.                  var field = updatelineform.getItems()[i+1].getFieldName(); 
  6.                    if(j == null || j.length == 0 ){//js的非空验证 
  7.                    }else{ 
  8.                      if(updateinfo == null || updateinfo.length == 0){ 
  9.                            updateinfo  =field+"@"+j; 
  10.                            console.log("info1="+updateinfo); 
  11.                       }else{ 
  12.                            updateinfo  =updateinfo+","+field+"@"+j; 
  13.                            console.log("info2="+updateinfo); 
  14.                       } 
  15.                    } 
  16.                 } 

[html] view plain copy print ?
  1. if(updateinfo == null || updateinfo.length == 0) 

js中不支持这样写:

var s ;

if(s==" ")

你可能感兴趣的:(js非空验证)