Creating Smarter Dialogs

Another common design element in modern sites are dialogs that don’t look like the usual prompt(), alert(), or confirm() ones we learned about back in Chapter 2. Instead, they look more like the dialogs you see in applications, such as modal dialogs, that is, dialogs that force you to respond to them before you can go back to the Web page. Once again, jQuery makes it straightforward to accomplish a task.

To create smarter dialogs:

1.
<link type="text/css" rel="stylesheet" href="jquery/theme/contrast.css" />
We’ve created our own custom theme here using ThemeRoller (as mentioned in the previous task), and named it contrast.css. Here’s where Script 16.6 loads it into our page.
2.
<script type="text/javascript" src="jquery/ui.dialog.js"></script> ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.