主要配置代码
1 2 3 4 5 6 7 | alert: function (msg){ this .show({buttons:{yes: '确认' },msg:msg,title: '消息' }); }, confirm: function (msg,fn){ //fn为回调函数,参数和show方法的一致 this .show({buttons:{yes: '确认' ,no: '取消' },msg:msg,title: '提示' ,fn:fn}); }, |
主要代码块,主要原因是兼容性好,所以给大家分享了,confirm弹窗 具有确定和取消的功能,这个功能很实用,
前台的话,使用
1 2 | < input type = "button" value = "Showbo.Msg.alert" onclick = "Showbo.Msg.alert('您好,请先注册或登录!')" /> < input type = "button" value = "Showbo.Msg.confirm" onclick = "Showbo.Msg.confirm('您确定删除这条记录吗?')" /> |
只需在调用的时候,把alert 或者 confirm 替换成
1 | Showbo.Msg.alert('') or Showbo.Msg.confirm('') |
是不是很简单
<input type="botton" id="button5" value="删除选中项目" onclick="if(!Showbo.Msg.confirm('确实要删除吗?')){return false}"/>
怎样提交表单数据? 我改 type="submit" 不加Showbo.Msg.confirm就能弹出询问 加Showbo.Msg.之后还没弹出框就提交表单了 怎么回事 有办法解决吗?