使用CSS的非常简单的Alert and Confirm Box样式

TLS*_*LSK 3 html javascript css jquery

我有以下简单的确认框代码

<!DOCTYPE html>
<html>
    <body>
        <p>Click the button to alert the hostname of the current URL.</p>

        <button onclick="myFunction()">Try it</button>

        <script>
            function myFunction() {
                confirm("Confirm!!!!");
            }
        </script>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

但是我的问题是我想让CSS用一种非常简单的方式设置“确定”和“取消”按钮的样式。我正在寻找一个真正简单的解决方案。

Mat*_*est 5

这个问题被问了更多:

回答; 您不能为对话框的Confirm()函数设置样式,因为它是浏览器的通用类。


您将必须搜索类似以下的替代方法:

您也可以尝试创建自己的对话框。这不是您所要求的那么简单。但是,可以找到很多教程:

(对不起,作为一个初学者,我不允许放置更多链接)