title: Setting razor variables in javascript
body: <p>I am trying to assign a razor variable with the contents of a combo box on my form from within a javascript function.  Like so:</p>
  
  <pre><code>&lt;script type ="text/javascript"&gt;
  &lt;!--
      function SomeFunction() {
  
          var hours = document.getElementById("Hours");
          var task = document.getElementById("TaskType_ID");
          @{            
              var tsk = @:task.value;            
           }
  
          @{            
          &lt;text&gt;
              hours.value = '@ViewBag.TaskTypes.GetHours(tsk)';
          &lt;/text&gt;
          }
  
          return true;
      }
  
  //--&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>the line (and every other variation I've tried) </p>
  
  <pre><code>var tsk = @:task.value;
  </code></pre>
  
  <p>results in an error.  </p>