我有以下代码:
<html> <head>
<!-- Required CSS --> <link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/2.9.0/build/treeview/assets/skins/sam/treeview.css"> <!-- Optional CSS for for date editing with Calendar--> <link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/2.9.0/build/calendar/assets/skins/sam/calendar.css"> <!-- Dependency source file --> <script src="http://yui.yahooapis.com/2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"
></script> <!-- Optional dependency source file --> <script src="http://yui.yahooapis.com/2.9.0/build/animation/animation-min.js" type="text/javascript"></script> <!-- Optional dependency source file for date editing with Calendar--> <script src="http://yui.yahooapis.com/2.9.0/build/calendar/calendar-min.js"
></script> <!-- Optional dependency source file to decode contents of yuiConfig markup attribute--> <script src="http://yui.yahooapis.com/2.9.0/build/json/json-min.js" ></script> <!-- TreeView source file --> <script src="http://yui.yahooapis.com/2.9.0/build/treeview/treeview-min.js"
></script>
</head> <body class="yui-skin-sam">
@model IEnumerable< ESimSol.BusinessObjects.MenuTreeNode>
<input type="button" id="btnAdd" value="Refresh" /> <label id="lblTest"> </label> <div id="treeDiv1"> <ul>
@foreach (var item in Model)
{
if (item.ParentID == 0)
{
<li>
@Html.DisplayFor(modelItem => item.MenuName)
<ul>
@Html.Partial("TreeViewControl", item)
</ul>
</li>
}
} </ul> </div> </body> </html>
<script type="text/javascript">
$(document).ready(function () {
treeInit();
});
var tree;
function treeInit() {
tree = new YAHOO.widget.TreeView(document.getElementById("treeDiv1"));
}
</script>
当我想执行我的脚本时,我面临以下异常:
Microsoft JScript runtime error: Object expected
任何人都给我一个完整的参考,使用 MVC3 RAZOR View 引擎执行 javascript?