2012-04-24 87 views
1

嗨,是否有可能将窗口提示上的确定和取消按钮更改为只有一个“关闭”按钮?为了我的目的,我喜欢window.prompt显示我的链接,并且很容易复制,因为它已经被突出显示。这里是我的代码:在window.prompt上更改确定/取消?

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

谢谢!

+3

回答不,这是不可能的。你可以把链接放在一个''中,并使用JavaScript来''focus()'。 – 2012-04-24 14:59:55

+1

为什么最近有这么多人使用提示进行复制粘贴? – epascarello 2012-04-24 15:01:49

+0

如果你没有建议闪光,有很多解决方案可以让你点击一个按钮并复制到粘贴缓冲区,如http://code.google.com/p/zeroclipboard/ – dstarh 2012-04-24 15:04:06

回答

-2

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

请给予downvote的理由? – 2012-04-24 15:35:46

+1

我没有downvote,但它可能是因为这需要[jQuery插件](http://www.abeautifulsite.net/blog/2008/12/jquery-alert-dialogs/),你没有提到。 – 2012-04-24 15:43:50

+1

我没有downvote。我是OP。另一个安德鲁要求答案,而不是我。不过,我会看看这个,谢谢。 – Andrew 2012-04-24 15:45:26

相关问题