2012-04-24 14 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