简体   繁体   English

更改弹出消息框中文本的颜色

[英]Change color of text in pop up message box

I have a message box that pops up to display a message if any field is left blank on a form. 如果表单上的任何字段为空,我都会弹出一个消息框以显示一条消息。 But I want to change the color of the writing to red 但我想将文字颜色更改为红色

protected void DisplayMsg(string Msg)
    {
        string script = "<script>$(document).ready(function () {  $(\"<div>" + Msg.Replace("'","").Replace("\"","")+ "</div>\").dialog({modal: true,title: \"NOTE\",buttons: [ { text: \"Ok\", click: function() { $( this ).dialog( \"close\" ); } } ]}); });</script>";
        ClientScript.RegisterClientScriptBlock(this.GetType(), "Message", script);
    }

How do I change the color of the text? 如何更改文字的颜色?

只需向您的div元素添加样式,就像这样

"<div style='color:red'>" + Msg.Replace("'","").Replace("\"","")+ "</div>\"

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

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