为了账号安全,请及时绑定邮箱和手机立即绑定

求各位帮忙看看为什么这个运行出来没有button键,运用的backbone框架

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>backbone.js--helloworld</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
    <script src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>
    <script src="http://ajax.cdnjs.com/ajax/libs/underscore.js/1.1.6/underscore-min.js"></script>
    <script src="http://ajax.cdnjs.com/ajax/libs/backbone.js/0.3.3/backbone-min.js"></script>

</head>
<body>
<a href="http://www.imooc.com">更多学习资源</a>
<script>
 (function ($) {
        var Fview=backbone.view.extend({
            el:$('body'),
            events:{
                'click button#add':'additem'
 },
            initialize:function () {
                _.bindAll(this,'render','additem');
                this.render();
            },
            render:function(){
                $(this.el).append("<button id='add'>报道</button>");
                $(this.el).append("<ul></ul>");
            },
            additem:function(){
                var name=prompt("请问你来自:");
                if (name==null)
                    name="x";
                $('ul', this.el).append("<li>hello,"+this.name+"</li>");
            }
        });
        var fview=new Fview();
    })(jQuery);
</script>
</body>
</html>


正在回答

1 回答


没发现

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

求各位帮忙看看为什么这个运行出来没有button键,运用的backbone框架

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信