The Care and Feeding of divalert()
Installation
Installing and using divalert is very simple. If it weren't I wouldn't use it and I wouldn't expect anyone else to either. It is completely contained in a single file. Grab divalert.js here.
After grabbing divalert.js, include it in your page like so:
<script type="text/javascript" src="divalert.js"></script>
That's all there is to installation!
Use
Using divalert is quite simple. Call divalert() with the string of your choice just as you would with alert().
<script type="text/javascript">
var goodStuff = "ice cream";
divalert("Good stuff: "+goodStuff);
</script>
If you've been a Javascript developer for a while, you're probably wondering what happens when you call divalert() before the page body is loaded. Excellent question. When this occurs, divalert() does not attempt to append itself to the document body. Instead, it waits invisibly in memory and attaches an event handler to window.onload. Check out the example to see it in action. Notice that when it is called before the body loads, divalert() automatically prints a message, *Page Loaded* when the body has loaded. This in and of itself can be quite helpful for debugging.
One final thing you can do when calling divalert() is to call for a bold alert. Simply call divalert with "true" as your second parameter:
divalert('Bold Text', true);

