If Statement does not work with AND (&&) Operator

It's hard for me to write down what seems like a simple expression! I need him to say that if mod is not equal to a, b or c - then do it. Here is what I tried, but failed:

var mod = CURRENT_MODULE_ID;
if (mod != "5827289" && mod != "5195103" && mod != "5181422") {
   doSomething();
}

When I introduce it into my editor, he says that there is an error, in particular that "the name of the object should immediately follow the" & "in the entity reference." .. and does not work when I go to the test.

Any help is appreciated!


UPDATE: URL: esber.squarespace.com

Full script:

<script type="text/javascript" src="/storage/scripts/sessvars.js"></script>
<script type="text/javascript">
<![CDATA[ 

onload=function(){
 sessvars.browserConfirmation?'none':'';
 sessvars.ageConfirmation?'none':'';
}; 

var mod = Squarespace.Constants.CURRENT_MODULE_ID;
if (mod != "5827289" && mod != "5195103" && mod != "5181422") {
   if(sessvars.ageConfirmation != "yes"){
      window.location = "/verify/";
   };
};

]]>
</script> 

, , (/), " " (/ ) page (/login) - sessvars, .

, esber.squarespace.com ( , ) - /verify, .

script :

<script type="text/javascript" src="/storage/scripts/sessvars.js"></script>
<script type="text/javascript">

onload=function(){
 sessvars.browserConfirmation?'none':'';
 sessvars.ageConfirmation?'none':'';
}; 

var mod = Squarespace.Constants.CURRENT_MODULE_ID;
if (mod != "5827289") {
   if(sessvars.ageConfirmation != "yes"){
      window.location = "/verify/";
   };
};

</script> 

(?)

+3
7

:

// <![CDATA[ 

onload=function(){
 sessvars.browserConfirmation?'none':'';
 sessvars.ageConfirmation?'none':'';
}; 

var mod = Squarespace.Constants.CURRENT_MODULE_ID;
if (mod != "5827289" && mod != "5195103" && mod != "5181422") {
   if(sessvars.ageConfirmation != "yes"){
      window.location = "/verify/";
   };
};

// ]]>

, , -.

+6

script CDATA.

<script type="text/javascript">
<![CDATA[

// script here

]]>
</script>
+4

javascript XML-?

, XML- , , &

Javascript .

Try:

var mod = CURRENT_MODULE_ID;
if (mod != "5827289" &amp;&amp; mod != "5195103" &amp;&amp; mod != "5181422") {
   doSomething();
}

, javasciprt

:

:

<script type="text/javascript">
<![CDATA[
var mod = CURRENT_MODULE_ID;
if (mod != "5827289" && mod != "5195103" && mod != "5181422") {
   doSomething();
}
]]>
</script>
+1

, , :

function doSomething() {alert("doing");}
var CURRENT_MODULE_ID = 5195103000;
var mod = CURRENT_MODULE_ID;
if (mod != "5827289" && mod != "5195103" && mod != "5181422") {
   doSomething();
}

"doSomething". 5195103, .

, script ? , , , CURRENT_MODULE_ID?

+1

, , XML-. ? , ?

0

ID ? ?

var mod = CURRENT_MODULE_ID;
if (mod != 5827289 && mod != 5195103 && mod != 5181422) {
   doSomething();
}

var mod = CURRENT_MODULE_ID;
if (!mod.match("5827289|5195103|5181422")) {
   doSomething();
}
0

script XSL.

Entity '&'

script, .

CDATA

<script>
  var  Quantity860=<xsl:value-of select="$QuantityOrdered_860" />;
  var  Quantity850=<xsl:value-of select="$QuantityOrdered_850" />;
  var  QuantityToReceive860=<xsl:value-of select="$QuantityLeftToReceive_860" />;

  if(parseFloat(Quantity860.textContent) !== parseFloat(Quantity850.textContent) <![CDATA[ && ]]> parseFloat(QuantityToReceive860.textContent) !== parseFloat(Quantity850.textContent))
  {
      Quantity860.style.color="#FF6347";
      Quantity850.style.color="#FF6347";
      QuantityToReceive860.style.color="#FF6347";
  }
</script>
0

Source: https://habr.com/ru/post/1731491/


All Articles