Knockoutjs demo
首先需要 knockoutjs的js文件
可以在 http://knockoutjs.com/ 下载
例子 :
<html>
<head>
<title></title>
</head>
<body>
<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"></Strong></p>
<p>Last Name:<input data-bind="value:lastname"></Strong></p>
</body>
<script src="knockout-2.3.0.js"></script>
<script>
function AppViewModel(){
this.firstname=ko.observable("stephen");
this.lastname=ko.observable("Huang");
}
ko.applyBindings(AppViewModel());
</script>
</html>