Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/428.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
不等于JavaScript中的Null条件_Javascript_Null_Comparison - Fatal编程技术网

不等于JavaScript中的Null条件

不等于JavaScript中的Null条件,javascript,null,comparison,Javascript,Null,Comparison,我在Salesforce中的一个按钮上使用了以下代码--onClick JavaScript: 这是正确的方法吗 if('{!Account.CSS_CustomerID__c}' != 'null'){ //do something } 我应该这样做吗--1 if('{!Account.CSS_CustomerID__c}' != null){ //do something } if('{!Account.CSS_Custom

我在Salesforce中的一个按钮上使用了以下代码--onClick JavaScript:

这是正确的方法吗

if('{!Account.CSS_CustomerID__c}' != 'null'){

          //do something
}
我应该这样做吗--1

 if('{!Account.CSS_CustomerID__c}' != null){

              //do something
    }
 if('{!Account.CSS_CustomerID__c}' !== null){

              //do something
    }
我应该这样做吗--2

 if('{!Account.CSS_CustomerID__c}' !== null){

              //do something
    }
还是有别的办法

回答:这对我很有效

 if('{!Account.CSS_CustomerID__c}' != null){

              //do something
    }
 if('{!Account.CSS_CustomerID__c}' !== null){

              //do something
    }

用代码比较两个字符串

也许您需要比较变量:

if(!Account.CSS_CustomerID__c != null)

您正在将
string
与不相同的
string
进行比较..很明显,第一个字符串不等于第二个字符串,或者您解释得不好..我检查了现有的问题。。。。但是我无法找到如何检查不等于NULL的条件,你能给我上面if条件的确切语法吗