原生
对话框
confirm(message);
新窗口
window.open(url);
例子
<div>
<button οnclick="Click1()">原生confirm</button>
<button οnclick="Click2()">layerUi</button>
</div>
<script>
var layerOpen = null;
function Click1() {
if (confirm("确定打开网页么吗?")) {
window.open("NewPage");
}
}
function Click2() {
layerOpen= layer.confirm('确定打开网页么吗?', {
btn: ['确定','取消'] //按钮
}, function(){
window.open("NewPage");
layer.close(layerOpen);
}, function(){
});
}
</script>