小黑小波比.在表单div添加事件on,调用JS的事件

在某路径下.Client/Views/Admin/registered.tpl

<div class="tab-pane" id="par" on="btnQuery"><!--在这里添加事件on=“btnQuery”-->
				 <div class="form-group" id="${admin_form_user}">
					<input type="text" class="form-control" placeholder="家长邮箱/手机号" id="${admin_login_user}">
				</div> <div class="form-group" id="${admin_form_pwd}">
					<input type="password" class="form-control" placeholder="密码" id="${admin_login_pwd}">
				</div>
				<div class="form-group" id="${admin_form_user}">
					<input type="text" class="form-control" placeholder="确认密码" id="${admin_login_user}">
				</div>
				<div class="form-group" id="${admin_form_pwd}">
					<input type="password" class="form-control" placeholder="真实姓名" id="${admin_login_pwd}">
				</div>
				
				<div class="form-group" id="${admin_form_pwd}">
					<input type="password" class="form-control" placeholder="密码" id="${admin_login_pwd}">
				</div>
			</div>


在某路径下.Client/Scripts/GUI/Admin/registered.js

app.gui.define('Admin.registered', function() {

    var events = {
        btnQuery: function(sender, arg) { //这里是进入btnQuery事件
        //查询数据
        alert('a');//弹出提示框,内容为“a”
        }
    };

    awf.task({
        code: "Data",
        method: function(e) {
            e.success([]);
        }
    }).task({
        code: "tpl",
        method: function(e) {
            app.tpl("Admin->registered", function(tpl) {
                e.success(tpl);
            });
        }
    }).async({
        success: function(result) {
            result.cid = 'main' + app.genID();

            var info = result.tpl(result, {});
            app.gui.page(info);
            app.gui.on(_('#' + result.cid), events);//这里是读取路径cid,然后带值进去事件
        }
    });
});


你可能感兴趣的:(小黑小波比.在表单div添加事件on,调用JS的事件)