title: javascript with MVC 3 Razor view engine
body: <p>I have following code : </p>
  
  <pre><code>&lt;html&gt; &lt;head&gt;
        &lt;!-- Required CSS --&gt; &lt;link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/2.9.0/build/treeview/assets/skins/sam/treeview.css"&gt; &lt;!-- Optional CSS for for date editing with Calendar--&gt; &lt;link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/2.9.0/build/calendar/assets/skins/sam/calendar.css"&gt; &lt;!-- Dependency source file --&gt;  &lt;script src="http://yui.yahooapis.com/2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"
  &gt;&lt;/script&gt; &lt;!-- Optional dependency source file --&gt;  &lt;script src="http://yui.yahooapis.com/2.9.0/build/animation/animation-min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;!-- Optional dependency source file for date editing with Calendar--&gt;  &lt;script src="http://yui.yahooapis.com/2.9.0/build/calendar/calendar-min.js"
  &gt;&lt;/script&gt; &lt;!-- Optional dependency source file to decode contents of yuiConfig markup attribute--&gt;  &lt;script src="http://yui.yahooapis.com/2.9.0/build/json/json-min.js" &gt;&lt;/script&gt; &lt;!-- TreeView source file --&gt;  &lt;script src="http://yui.yahooapis.com/2.9.0/build/treeview/treeview-min.js"
  &gt;&lt;/script&gt;
       &lt;/head&gt; &lt;body class="yui-skin-sam"&gt;
  
  @model IEnumerable&lt; ESimSol.BusinessObjects.MenuTreeNode&gt;           
  
  &lt;input type="button" id="btnAdd" value="Refresh" /&gt; &lt;label id="lblTest"&gt; &lt;/label&gt; &lt;div id="treeDiv1"&gt; &lt;ul&gt;    
      @foreach (var item in Model)
      {
          if (item.ParentID == 0)
          {
              &lt;li&gt;
                  @Html.DisplayFor(modelItem =&gt; item.MenuName)  
                  &lt;ul&gt;
                      @Html.Partial("TreeViewControl", item)   
                  &lt;/ul&gt;
               &lt;/li&gt; 
          }
      }   &lt;/ul&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;
  
  
  &lt;script type="text/javascript"&gt;
  
      $(document).ready(function () {
          treeInit();
      });
  
      var tree;
      function treeInit() {
          tree = new YAHOO.widget.TreeView(document.getElementById("treeDiv1"));
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>When I want to execute my script i face following Exception:</p>
  
  <pre><code>Microsoft JScript runtime error: Object expected
  </code></pre>
  
  <p>any one give me a complete reference for javascript execute with MVC3 RAZOR View engine?</p>