Solved

BOLD and color RED an alert() popup ??

Posted on 2007-12-03
9
6,857 Views
Last Modified: 2008-02-01
Hi All,
    I have an alert() with text in it. My customer wants part of the text to be BOLD and RED.
    Is there a way to do this?
Thanks, Bill
0
Comment
Question by:bcarlis
  • 5
  • 4
9 Comments
 
LVL 29

Expert Comment

by:Göran Andersson
ID: 20396726
No, that is not possible.

If you want to change anything about how the alert looks, you have to make your own popup window.
0
 
LVL 2

Author Comment

by:bcarlis
ID: 20396818
How do you do that?

If I want to have it look like the "alert()" but be able to control text color, weight, font... what would I need to do?
0
 
LVL 29

Expert Comment

by:Göran Andersson
ID: 20397287
Well, you can't really make it look like an alert window, as an alert window looks completely different depending on the browser, operating system, desktop style, et.c.

A popup window is just a page that you open using window.open.

http://msdn2.microsoft.com/en-us/library/ms536651.aspx

If you are developing strictly for Internet Explorer, you can use window.showModalDialog, which gives you a modal popup window.
0
 
LVL 2

Author Comment

by:bcarlis
ID: 20450285
So it is not doable...

Reimburse points?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 29

Expert Comment

by:Göran Andersson
ID: 20452399
> So it is not doable...

To do exactly what you asked for is impossible. You got some alternatives, if you clarify the question with what you want to accomplish rather than just asking about the limitations of an alert box, there might be even more alternatives.

For example, when do you show the alert box, and why did you choose an alert box to show the information?

> Reimburse points?

Well, you got a definitive answer to your question. Just because the answer is "no", doesn't mean that there is anything wrong with it. And I'm still here to see if there might be some other alternatives in your impossible mission...
0
 
LVL 2

Author Comment

by:bcarlis
ID: 20538276
Sorry GreenGhost,
I didn't realize you had posted another response.. I must have overlooked the email..

What I am using the alert for is an error message popup.
in my code I have:

alert(errormsg);

but the customer wants red and bold words to show up  better.

Is there an easy code snippet that I could replace the alert using a window without alot of research?
Thats why I increased points to 300..

Thank you in advance.. Bill
0
 
LVL 2

Author Comment

by:bcarlis
ID: 20583645
Hello, Anyone out there?
0
 
LVL 29

Accepted Solution

by:
Göran Andersson earned 300 total points
ID: 20589974
You could open up a window displaying the error message.

Example below. You can of course change the settings when you open the window, and what you write to the popup, to change the apperence.
function showError(message) {

   var w = window.open('', '_blank', 'width=300,height=200');

   w.document.open();

   w.document.write(

      '<html>'+

      '<head>'+

      '<title>Error</title>'+

      '<style>body{font-weight:bold;color:red;}</style>'+

      '</head>'+

      '<body>'+message+'</body>'+

      '</html>'

   );

   w.document.close();

}
 

showError('Something didn't go completely right...');

Open in new window

0
 
LVL 2

Author Comment

by:bcarlis
ID: 20647654
Hi GreenGhost,
Sorry it took so long to get back to this... that is great. I can add onto that in many situations...
Thank you, Bill
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Form with Modals 16 46
jQuery not working on ELSE... why? 2 25
ASP.NET gridview select textbox on focus 2 17
maps stopped work unsure why 7 10
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now