简体   繁体   English

更改window.prompt上的OK / Cancel?

[英]Change OK/Cancel on window.prompt?

Hi is it possible to change the OK and Cancel buttons on the window prompt to just one "Close" button? 您好,是否可以将窗口提示上的“确定”和“取消”按钮更改为仅一个“关闭”按钮? For my purpose I like that the window.prompt shows my link and is easy to copy because it's already highlighted. 出于我的目的,我喜欢window.prompt显示我的链接并且易于复制,因为它已被突出显示。 Here is my code: 这是我的代码:

function sLink()
    {   
        var ctr = map.getCenter();
        var text = "http..../viewer-emailtest.shtml?lat="+ ctr.lat().toString() + "&lng=" + ctr.lng().toString() + "&z=" + map.getZoom().toString()
        window.prompt("Copy the highlighted link below and paste into your email program to share:", text);
      }

Thank you! 谢谢!

As per OP comment, answering in jquery 根据OP评论,在jQuery中回答

jQuery.alerts.okButton = 'Continue';
jQuery.alerts.cancelButton = 'Cancel';
jQuery.alerts.confirm("are you sure to do ?","Confirm",function(result){
     if(result){
        alert("you selected continue");
     }else{
        alert("you selected cancel");
     }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM