?
Solved

Trying to "fancy up" the JavaScript ALERT.

Posted on 2011-03-06
8
Medium Priority
?
739 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 252 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 252 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 248 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Assisted Solution

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

840 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