给予点击事件,然后调用以下方法即可(我这用的是jq的点击):
$(function() { Cz.Alert().success({text: ‘请返回公众号查看充值结果‘}); $(".alert-btn-cancel").click(function() { openwx(); }) }) function openwx(){ locatUrl = "weixin://"; if(/ipad|iphone|mac/i.test(navigator.userAgent)) { var ifr =document.createElement("iframe"); ifr.src = locatUrl; ifr.style.display = "none"; document.body.appendChild(ifr); }else{ window.location.href = locatUrl; } }