<script type='text/javascript' src='Script/v1.0.js'></script>
<script type="text/javascript" src="Script/jquery-1.6.2.min.js"></script>
這是一個簡單視圖模型 - JavaScript的定義數據和UI的行爲:錯誤在Visual Studio中的數據綁定屬性2008
function AppViewModel() {
this.firstName = ko.observable("Bert");
this.lastName = ko.observable("Bertington");
this.fullName = ko.computed(function() {
return this.firstName() + " " + this.lastName();
}, this);
}
激活knockout.js:
ko.applyBindings(new AppViewModel());
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<p>First name: <strong data-bind="text: firstName"></strong></p>
<p>Last name: <strong data-bind="text: lastName"></strong></p>
<p>First name: <input data-bind="value: firstName" /></p>
<p>Last name: <input data-bind="value: lastName" /></p>
<p>Full name: <strong data-bind="text: fullName"></strong></p>
</div>
</form>
</body>
data-bind is not working.
error:databind is not a valid attribute
這是** knockoutjs **中最簡單的例子。你如何得到這個錯誤? – nav0611 2013-02-25 09:19:52
爲什麼我得到這個錯誤。我應該使用html5。是否有可能在視覺工作室2008 – user2028956 2013-02-25 09:33:58
請嘗試下面的答案 – nav0611 2013-02-25 11:06:16