Solved

Trying to "fancy up" the JavaScript ALERT.

Posted on 2011-03-06
8
733 Views
Last Modified: 2012-05-11
Take a look at the attached image.  This shows the result of some JavaScript validation that I built into a web form.  The JavaScript gets the job done.  The user sees the message they need to.  I sure would like to make the alert look a little nicer, however.  

- Is there a way to add a custom title to the alert as opposed to "The page at http://parkassets.boulder.local says..."?
- Is it possible to add icons to alerts?  (Like a yield sign with an exclamation point, or a big red "X")?

It might be worth noting that the image shown below comes from an ASP.NET call that prompts a JavaScript call.
SimpleAlert.jpg
0
Comment
Question by:jdana
8 Comments
 
LVL 1

Accepted Solution

by:
geff_chang earned 63 total points
ID: 35046070
Unfortunately, you can't change the title.

For fancy dialogs, you can try using 3rd-party jQuery dialogs.
Check this out: http://jqueryui.com/demos/dialog/
0
 
LVL 29

Assisted Solution

by:Badotz
Badotz earned 63 total points
ID: 35046443
You can use a DHTML replacement for the alert popup.

http://dhtmlpopups.webarticles.org/
0
 
LVL 7

Assisted Solution

by:foobarr
foobarr earned 62 total points
ID: 35061847
You could create your own aspx page and instead of using alert("Your Message") you could call that page with specific parameters and just have the page popup as a modal dialog window
0
 
LVL 3

Assisted Solution

by:timhigham
timhigham earned 62 total points
ID: 35063340
Using Javascript 'window.open' allows setting a title for and dimensioning a new window.
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 2

Expert Comment

by:cyberhitesh
ID: 35085630
you will have to create your own modal window that would act as alert box. Try using modal window provided by jQuery.
0
 
LVL 29

Expert Comment

by:Badotz
ID: 35086013
jQuery? Is all that overhead really necessary?
0
 

Author Closing Comment

by:jdana
ID: 35095245
geff,

I like the jQuery suggestion.  Since the page already calls about 200 lines of jQuery code, I figure a few more aint gonna hurt.

Badotz,

The DHTML suggestion is interesting.

foobar,

If I wasn't already using jQuery, I'd take your approach.

timhigham,

window.open sounds like really economic solution.  

Thanks to all!
0
 
LVL 29

Expert Comment

by:Badotz
ID: 35095340
No worries - glad to help.
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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

919 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