0
新來這個,我不能讓這個簡單的淘汰賽應用程序工作。它應該顯示淘汰js應用程序 - 不能正常工作
你好,行星地球!
我引用:http://knockoutjs.com/examples/helloWorld.html
下面是當我運行中的index.html:
難道沒有找到淘汰賽,3.4.2.js文件?
這裏是控制檯。看起來有錯誤。
下面是index.html文件 「:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello World</title>
<!-- Import the Knockout file. -->
<script type="text/javascript" src="C:\Dans\Work 2\Tech\Web Dev\Javascript and jQuery\Knockout.js\Examples\knockout-3.4.2.js"></script>
<!-- Import the JavaScript file. -->
<script type="text/javascript" src="app.js"></script>
</head>
<body>
<div class='liveExample'>
<p>First name: <input data-bind='value: firstName' /></p>
<p>Last name: <input data-bind='value: lastName' /></p>
<h2>Hello, <span data-bind='text: fullName'> </span>!</h2>
</div>
</body>
這裏的視圖模型文件 - app.js文件」:
var ViewModel = function(first, last) {
this.firstName = ko.observable(first);
this.lastName = ko.observable(last);
this.fullName = ko.computed(function() {
return this.firstName() + " " + this.lastName();
}, this);
};
ko.applyBindings(new ViewModel("Planet", "Earth"));
這裏就是我有它存儲:
你可以使用C:\ ....作爲src嗎?如果您使用像https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js這樣的CDN,會發生什麼情況? – ggdx
您的瀏覽器控制檯中是否有錯誤? (ctrl-shift-i) –
我試過CDN ..它沒有改變行爲。 – user3020047