2
我正在嘗試用Backbone做一個非常簡單的hello world。閱讀文檔和例子之後,我覺得這應該工作,但是當我點擊不會做任何事情:骨幹查看點擊世界你好
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.cdnjs.com/ajax/libs/underscore.js/1.1.4/underscore-min.js"></script>
<script type="text/javascript" src="http://ajax.cdnjs.com/ajax/libs/backbone.js/0.3.3/backbone-min.js"></script>
<script type="text/javascript">
var AppView = Backbone.View.extend({
events: {
'click #new': 'createNew'
},
//CREATE
createNew: function(){
alert('yea');
}
});
var app_view = new AppView();
</script>
</head>
<body>
<a href="#new" id="new">new</a>
</body>
</html>
我這麼想嗎?什麼可能是錯的?
就是這樣,謝謝你benoit! – anders