jqalert is a Javascript library that uses jQuery to create a compelling alternative to window.alert().
Author: Jon Davis [ http://www.jondavis.net/ ]
Current version: 0.9
jqalert.js (unpacked - 25kb)
Requires: jQuery v1.2.3 (or later) @
http://www.jquery.com/
Suggested: jqDnR by Brice Burgess @
http://dev.iceburg.net/jquery/jqDnR/
Note that this current build still has a few bugs and missing features. Among the bugs is the use of getEmptyOptions() and then setting {modal: true} can have unpredictable results, as demonstrated below.
Skin it. Or just wait; coming in a future build will be more named styles and named style extensibility. Also plan to add more optional buttons like OK / Cancel, or Yes / No, or Yes / No / Cancel, along with dialog result.
Just add the following tags to your <head>:
<script type="text/javascript" language="javascript" src="http://cachefile.net/scripts/jquery/1.2.3/jquery-1.2.3.js"></script> <script type="text/javascript" language="javascript" src="http://cachefile.net/scripts/jquery/plugins/jqDnR/2007.08.19r2/jqDnR.js"></script> <script type="text/javascript" language="javascript" src="http://cachefile.net/scripts/jquery/plugins/jqalert/0.9/jqalert.js"></script>
.. then when you need to do an alert(message), instead call jqalert(message, title).
To make jqalert override window.alert, add this to your <head> tag:
<script type="text/javascript" language="javascript">
try {
window.alert = window.jqalert;
} catch (err) {
window.alert('Your browser does not support overloading window.alert. ' + err);
}
</script>