2017-06-06 89 views
0

我想知道是否可以更改對話框中的確定/取消按鈕的文本?我可以編輯瀏覽器對話框的按鈕嗎?

enter image description here

+0

可能重複[Javascript確認彈出是,沒有按鈕而不是確定並取消](https://stackoverflow.com/questions/823790/javascript-confirm-popup-yes-no-button-instead-of-ok -and-取消) – CBroe

回答

0

您可以用HTML5,它允許你創建你自己定製的對話框,如下例所示:

HTML:

<dialog open id="favDialog"> 
    <form method="dialog"> 
    <section> 
     <p>Leave this site?</p> 
    </section> 
    <menu> 
     <button id="cancel" type="reset">No</button> 
     <button type="submit">Yes</button> 
    </menu> 
    </form> 
</dialog> 

請參閱live code

此代碼迄今爲止僅支持兩種主流瀏覽器,即Chrome 37和Opera 24(請參閱更多詳細信息here)。

相關問題