title: Javascript within Razor view engine
body: <p>I have the following javascript:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function doReveal() {
          if (@Model.C1 == true) {
              document.getElementById('A1').style.backgroundColor = 'yellow';
          }
          if (@Model.C1 == false) {
              document.getElementById('A1').style.backgroundColor = 'yellow';
          }
  &lt;/script&gt;
  </code></pre>
  
  <p>I wanted to make it so that the function doReveal would check the Model.C1 (which is a boolean) and then change the background color if it was true. </p>
  
  <p>However I get a message saying "conditional compilation is turned off" and a green squiggle under the Model.C1 and also the background color never changes even when I have both a true and false.</p>
  
  <p>I tested out the background change line and that works outside of the "if's". </p>
  
  <p>Looking at the page source I see this:</p>
  
  <pre><code>if (True == true) document.getElementById('A1').style.backgroundColor = 'yellow';
  </code></pre>
  
  <p>I changed it and removed the ==true but it still does not work. Even the following does not work. Yet it works is I remove the "if (True)" and just set the color. </p>
  
  <pre><code>if (True) document.getElementById('A1').style.backgroundColor = 'yellow';
  </code></pre>
  
  <p>Does anyone know what might be wrong?</p>