<div id="myModal" tabindex="-1" style="position:absolute;zIndex:9999;display:none;width:200px;height:220px;top:100px;left:100px;"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true" on="btnClose"> × </button> <h4 class="modal-title" id="myModalLabel"> 提示 </h4> </div> <div class="modal-body"> 验证成功! </div> <div class="modal-footer"> <button type="button" class="btn btn-primary" data-dismiss="modal" on="btnClose">确定 </button> </div> </div> </div> </div>
在确定和x按钮设定事件为on="btnClose"
btnClose:function(sender,arg){ _('#myModal').hide(); },在事件中插入这事件代码.#myModal代表id为myModal,hide()代表隐藏 show()代表显示