<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>YUI Coder &#187; Dialog</title>
	<atom:link href="http://www.yuicoder.com/category/dialog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.yuicoder.com</link>
	<description>Manipulating the Yahoo User Interface to your will!</description>
	<lastBuildDate>Mon, 16 Aug 2010 22:52:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Override alert() with a YUI Dialog</title>
		<link>http://www.yuicoder.com/2009/03/override-alert-with-a-yui-dialog/</link>
		<comments>http://www.yuicoder.com/2009/03/override-alert-with-a-yui-dialog/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 12:34:18 +0000</pubDate>
		<dc:creator>Jeffrey Cobb</dc:creator>
				<category><![CDATA[Dialog]]></category>
		<category><![CDATA[YUI Animation]]></category>
		<category><![CDATA[YUI Container]]></category>
		<category><![CDATA[YUI Get]]></category>
		<category><![CDATA[YUI Loader]]></category>
		<category><![CDATA[YUI Mish Mash]]></category>
		<category><![CDATA[Container]]></category>
		<category><![CDATA[Panel]]></category>
		<category><![CDATA[Simple Dialog]]></category>
		<category><![CDATA[window.alert]]></category>

		<guid isPermaLink="false">http://www.yuicoder.com/?p=51</guid>
		<description><![CDATA[You know and I know and everyone knows the alert boxes generated by the browsers are OLD-SCHOOL and look like garbage. Well using YUI you can easily change that by just including a little code in you page. Simply add the code below to the bottom of your page just before the end body tag [...]]]></description>
			<content:encoded><![CDATA[<p>You know and I know and everyone knows the alert boxes generated by the browsers are OLD-SCHOOL and look like garbage. Well using YUI you can easily change that by just including a little code in you page. Simply add the code below to the bottom of your page just before the end body tag then add the body style to the begining body tag called &#8220;yui-skin-sam&#8221; and that&#8217;s it. Oh and don&#8217;t forget to include your YUI Framework base and the additional scripts &#8220;container&#8221;, &#8220;dragdrop&#8221; and &#8220;animation&#8221;. For an example on how to included the YUI Framework and load specific parts check out <a href="http://www.yuicoder.com/2009/03/override-alert-with-a-yui-dialog/">for a quick start guide for YUI Loader and Yahoo CDN</a>.</p>
<pre name="code" class="JavaScript">
AlertDialog = new YAHOO.widget.SimpleDialog("dlg1", {
  width: "200px",
  effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.15},
  fixedcenter:true,
  modal:true,
  visible:false,
  close: true,
  constraintoviewport: true,
  buttons: [ { text:"close", handler: function(){this.hide();}, isDefault:true }],
  draggable:false,
                effect: [
                      { effect:YAHOO.widget.ContainerEffect.FADE,duration:0.1 }]
});

AlertDialog.setHeader("Alert");
AlertDialog.render(document.body);
window.alert = function(text) {
  AlertDialog.cfg.setProperty("text",text);
  AlertDialog.show();
};
</pre>
<p><a href="#" onclick="alert('Hello');return false; ">Click HERE</a> for an example:</p>
<h3>A permanent solution!</h3>
<p>If you would like to override the alert box throughout your entire site or application, save the code to your server in a public script folder. Example: as alertBox.js. Then load the script using YUI Get with-in the YUI Loader BEFORE firing off your init() routine. Here is an example.</p>
<pre name="code" class="JavaScript">
<script src="http://yui.yahooapis.com/2.7.0/build/yuiloader/yuiloader-min.js"</script>

<script>
var loader = new YAHOO.util.YUILoader({
    require: ["get","dom","event"],
    loadOptional: true,
    onSuccess: function() {
    Yevent = YAHOO.util.Event;
    Ydom = YAHOO.util.Dom;
    var objTransaction = YAHOO.util.Get.script("http://www.yuicoder.com/scripts/application/view/alertBox.js",	
{ onSuccess: function() {
                    	alert("file loaded");
                             });
    Yevent.onDOMReady(init);
    },
    timeout: 10000,
    combine: true
});
loader.insert();
function init(){
console.warn('YUI Loaded');
}
</script>
</pre>
<p><a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/dzone?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="DZone" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/dzone.png" width="16" height="16" alt="DZone"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="Facebook" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="Slashdot" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/yahoo_buzz?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="Yahoo Buzz" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/buzz.png" width="16" height="16" alt="Yahoo Buzz"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/yahoo_bookmarks?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="Yahoo Bookmarks" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/yahoo.png" width="16" height="16" alt="Yahoo Bookmarks"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="Digg" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/myspace?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="MySpace" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/myspace.png" width="16" height="16" alt="MySpace"/></a> <a href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/stumbleupon.png" width="16" height="16" alt="StumbleUpon"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/blogger_post?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="Blogger Post" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/blogger.png" width="16" height="16" alt="Blogger Post"/></a> <a href="http://www.addtoany.com/add_to/bebo?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="Bebo" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/bebo.png" width="16" height="16" alt="Bebo"/></a> <a href="http://www.addtoany.com/add_to/google_reader?linkurl=http%3A%2F%2Fwww.yuicoder.com%2F2009%2F03%2Foverride-alert-with-a-yui-dialog%2F&amp;linkname=Override%20alert%28%29%20with%20a%20YUI%20Dialog" title="Google Reader" rel="nofollow" target="_blank"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/icons/reader.png" width="16" height="16" alt="Google Reader"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.yuicoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.yuicoder.com/2009/03/override-alert-with-a-yui-dialog/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
