Click here to Skip to main content
15,117,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,

I have a alert message like this in javascript function.

alert(' Sec A - Financial Performance :  Draft \n Sec B - Human Resources :  Draft  \n Sec C - Intellectual Property  :  Completed \n');

Now, I want show the line of the section which in draft in red. i.e the line "Sec A - Financial Performance : Draft" in red color inside alert message.

how can i achieve this..??

Can Anyone help me out for this.


You won't be able to change the color with the built-in alert dialog. However, you can accomplish essentially the same thing with a modal dialog, which you will have complete control over the style with.
Karthik Harve 26-Dec-11 4:24am
Thanks for your answer.
What you want is one thing, and what you have is something else. To makes sure this is the way it is, its enough to take a look at the specifications:[^].

As you can see, no options; and this is easy to explain: those dialogs in fact run "outside" of the Web page, but as an OS dialog box running as owned by a Web browser. It's appearance depends on OS display settings, not your code.

If you want a custom look and perhaps behavior, you will need radically different approach: simulation of popup (modal) dialog behavior by means of HTML elements on your page working with JavaScript. This is already done in jQuery library complemented by its UI library.

You can freely download these libraries and use them in your application. See[^].

Naturally, you will be able to style the content of the dialog window by usual means of HTML and CSS the way you want.

Monjurul Habib 24-Dec-11 2:43am
Sergey Alexandrovich Kryukov 24-Dec-11 16:53pm
Thank you, Monjurul.
Karthik Harve 26-Dec-11 4:24am
Thank You
Use custom controls, see this CP article

ASP.NET Popup Control[^]
Monjurul Habib 24-Dec-11 2:42am
Sergey Alexandrovich Kryukov 24-Dec-11 16:55pm
That's a useful source, too; it shows usage samples; my 5.
Karthik Harve 26-Dec-11 4:25am
Thanks for your answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900