js怎么弹出自定义输入框php,js 自定义弹框

问题: IOS X上 alert和confirm 不出现弹窗,直接刷新页面

效果图

c364047b7396

image.png

html code

取消

确定

css code

/*add 190806*/

/*#conbtn{display: flex;flex-direction: row;align-items: center;flex-wrap: nowrap;}*/

#over{

width: 100%;

height: 100%;

position: fixed!important;

left: 0;

right: 0;

top: 0;

bottom: 0;

font-size: 22px;

background-color: rgba(145,152, 159, 0.5);

}

#over>div {

width: 300px;

height: 129px;

margin: 0 auto;

margin-top: 60%;

text-align: center;

padding: 1px;

background-color: white;

border-radius: 10px;

}

#content {

position: relative;

}

#close {

position: absolute;

top: -10px;

right: -10px;

width: 20px;

height: 20px;

cursor: pointer;

}

#over>div>h3 {

margin-top: 20px;

}

.over{

width: 100%;

height: 100%;

position: fixed!important;

left: 0;

right: 0;

top: 0;

bottom: 0;

font-size: 22px;

background-color: rgba(145,152, 159, 0.5);

z-index: 9999;

}

.over h3{ border-bottom: 1px solid #CCCCCC;padding-bottom: 20px;}

.conbtn span{width: 50%;display: block;font-size: 22px;text-align: center;padding: 10px 0;margin-top: 5px;}

.conbtn span:nth-child(1){border-right: 1px solid #CCCCCC;}

js code

var home_obj = {

//定义让模态窗口显示或隐藏的函数

showOrHidden: function (flag,u,id,str) {

// 获取到模态窗口

var over = document.querySelector('#over');

over.style.display = over.style.display == 'none' ? 'block' : 'none';

var tit = document.getElementById('tit');

tit.innerHTML = str

var cancelBtn = document.querySelector('#cancelBtn');

var sureBtn = document.querySelector('#sureBtn');

cancelBtn.onclick = function (ev){

console.log('取消');

over.style.display = over.style.display == 'none' ? 'block' : 'none';

}

sureBtn.onclick = function (ev){

// console.log('确定',ev);

// alert(flag)

if(flag == 'pay'){

console.log(u,id)

$.post("/wechat.php/xxx/?u="+u,'&id='+id,function(data){

if(data.ret == 1){

callpay(data.data, data.attach);

}else{

alert(data.msg)

}

})

}

else if(flag == 'warning'){

$.post("/wechat.php/xxx/?u="+u,'id='+id,function(data){

if(data.ret == 1){

window.location.reload()

}else{

alert('当前状态不是待发货状态');

window.location.reload()

}

})

}

else if(flag == 'shouhuo'){

$.post("/wechat.php/xxx/?u="+u,'id='+id,function(data){

if(data.ret == 1){

window.location.reload()

}else{

alert('当前状态不是待收货状态');

window.location.reload()

}

})

}

else if(flag == 'del'){

$.post("/wechat.phpxxx/",'u='+u+'&id='+id,function(data){

if(data.ret == 1){

window.location.reload()

}

})

}

else{return;}

}

},

}

//订单支付

$(document).on("click",".pay",function(){

home_obj.showOrHidden('pay',u,id,"确定支付吗?") // 弹窗

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值