简体   繁体   English

将CSS添加到JS警报消息中

[英]Adding css into a js alert message

I'm trying to add some css into a javascript alert message where alert message will get values to alert from php $_POST[];. 我正在尝试向JavaScript警报消息中添加一些CSS,其中警报消息将从php $ _POST [];获取警报值。 Please see the below code 请看下面的代码

$brandname = $_POST["brandname"];

 echo
    "
    <script>
    alert ('Your brand $brandname successfully added into system & redirecting to brand list page');
    window.location='http://localhost/im/carsale/brand_list.php';
    </script>
    ";

What I want to do is to add a h1 tag and change the color of $brandname value. 我想要做的是添加一个h1标签并更改$brandname值的颜色。 So could any explain me how to do that. 所以有谁能解释我该怎么做。

Use this jquery-confirm library for modern alerts. 使用此jquery-confirm库获得现代警报。 You can easily style,customize,change behavior them. 您可以轻松地设置样式,自定义,更改行为。 Most of the websites do NOT use default alert provided by browser using alert() function, because they are not customize-able. 大多数网站不使用浏览器通过alert()函数提供的默认警报,因为它们不可自定义。

This is a simple alert example using jquery-confirm . 这是一个使用jquery-confirm的简单警报示例。

$.alert({
    title: 'Alert!',
    content: 'Simple alert!',
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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