简体   繁体   中英

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. 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

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");
     }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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