<?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; Jeffrey Cobb</title>
	<atom:link href="http://www.yuicoder.com/author/admin/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.2.1</generator>
		<item>
		<title>CSS3 Playground</title>
		<link>http://www.yuicoder.com/2010/08/css3-playground/</link>
		<comments>http://www.yuicoder.com/2010/08/css3-playground/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 22:52:37 +0000</pubDate>
		<dc:creator>Jeffrey Cobb</dc:creator>
				<category><![CDATA[YUI Mish Mash]]></category>

		<guid isPermaLink="false">http://www.yuicoder.com/?p=191</guid>
		<description><![CDATA[Mike Plate, a freelance web and mobile developer has created a really useful web app perfect for playing around with CSS3. This will be surely something to bookmark under development tools. Check it out at CSS3 Playground]]></description>
			<content:encoded><![CDATA[<p>Mike Plate, a freelance web and mobile developer has created a really useful web app perfect for playing around with CSS3. This will be surely something to bookmark under development tools. Check it out at <a href="http://css3.mikeplate.com/">CSS3 Playground</a><br />
<a href="http://www.yuicoder.com/wp-content/uploads/2010/08/capture.png"></p>
<p>
<img src="http://www.yuicoder.com/wp-content/uploads/2010/08/capture-300x199.png" alt="" title="CSS3 Playground Screenshot" width="300" height="199" class="alignnone size-medium wp-image-192" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yuicoder.com/2010/08/css3-playground/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft Loves jQuery</title>
		<link>http://www.yuicoder.com/2010/03/microsoft-loves-jquery/</link>
		<comments>http://www.yuicoder.com/2010/03/microsoft-loves-jquery/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 23:59:12 +0000</pubDate>
		<dc:creator>Jeffrey Cobb</dc:creator>
				<category><![CDATA[YUI Mish Mash]]></category>

		<guid isPermaLink="false">http://www.yuicoder.com/?p=182</guid>
		<description><![CDATA[From Ajaxian Update: Here is a full set of release notes on the platform preview (called that as it is more of a shell than a browser. Rey Bango (Ajaxian and now Microsoft employee) will do a post that rounds up the news from MIX today where the IE9 team shared a first preview release [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ajaxian.com/archives/microsoft-loves-jquery">From Ajaxian</a></p>
<p>Update: Here is a <a href="http://ie.microsoft.com/testdrive/info/releasenotes/">full set of release notes</a> on the platform preview (called that as it is more of a shell than a browser.</p>
<p>Rey Bango (Ajaxian and now Microsoft employee) will do a post that rounds up the news from MIX today where the IE9 team shared <a href="http://ie.microsoft.com/testdrive/">a first preview release of IE9 </a>that comes with new features from HTML5+ (video, SVG, CSS3, addEventListener, JavaScript compilation spread across multicore, and more). All of this is hardware accelerated. Yum. Missing was news on canvas and I didn&#8217;t see deets on CSS transforms and the like (which would be awesome with hardware acceleration too).</p>
<p>John Resig just got on stage to talk about the collaboration between jQuery and Microsoft and how Microsoft is now contribution resources and code. For example, templates  (all on GitHub  which gives you:&#8230;.<a href="http://ajaxian.com/archives/microsoft-loves-jquery">MORE</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yuicoder.com/2010/03/microsoft-loves-jquery/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>YUI DataTable: Context Menu with &#8220;Select/Unselect All&#8221; rows</title>
		<link>http://www.yuicoder.com/2009/11/yui-datatable-context-menu-with-selectunselect-all-rows/</link>
		<comments>http://www.yuicoder.com/2009/11/yui-datatable-context-menu-with-selectunselect-all-rows/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 12:26:06 +0000</pubDate>
		<dc:creator>Jeffrey Cobb</dc:creator>
				<category><![CDATA[YUI Datatable]]></category>
		<category><![CDATA[YUI Mish Mash]]></category>

		<guid isPermaLink="false">http://www.yuicoder.com/?p=171</guid>
		<description><![CDATA[Andy from Coderfoo.com created this excellent example and code sniplet to demo a function he created that uses a context menu to select and deselect all rows from a YUI datatable. At first I simply thought he was just accessing a regular function within YUI but he soon corrected me. He explained that while YUI [...]]]></description>
			<content:encoded><![CDATA[<p>Andy from <a href="http://www.coderfoo.com">Coderfoo.com</a> created this excellent example and code sniplet to demo a function he created that uses a context menu to select and deselect all rows from a YUI datatable. At first I simply thought he was just accessing a regular function within YUI but he soon corrected me. He explained that while YUI has a deselect function for all rows a select all function did not exist. So knowing Andy he took on the challenge of creating this function. Thanks again Andy for sharing your code with us.<br />
Working Example on <a href="http://www.coderfoo.com">CoderFoo.com</a> <a href="http://www.coderfoo.com/examples/datatable-multi-row-select.html">http://www.coderfoo.com/examples/datatable-multi-row-select.html</a></p>
<h2>Get the code</h2>
<pre>
<textarea name="code" class="JavaScript" cols="60" rows="10">
YAHOO.lang.augmentObject(
  YAHOO.widget.DataTable.prototype, {
    _selectAllTrEls : function() {
      var selectedRowsEven = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_EVEN, "tr",this._elTbody);
      YAHOO.util.Dom.addClass( selectedRowsEven , YAHOO.widget.DataTable.CLASS_SELECTED);
      var selectedRowsOdd = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_ODD, "tr",this._elTbody);
      YAHOO.util.Dom.addClass( selectedRowsOdd, YAHOO.widget.DataTable.CLASS_SELECTED);
    },
  /* Selects all rows. * * @method selectAllRows */
  selectAllRows : function() {
    // Remove all rows from tracker
    var tracker = this._aSelections || [];
    for(var j=tracker.length- 1; j>-1; j--) {
      if(YAHOO.lang.isString( tracker[j] )){
        tracker.splice( j,1);
      }
    }
    // Update tracker
    this._aSelections = tracker;
    // Update UI
    this._selectAllTrEls();
    // Get all highlighted rows and make yahoo aware they are selected
    var selectedRowsEven = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_SELECTED, "tr",this._elTbody);
    for (i=0;i
<selectedRowsEven.length; i++){
      this.selectRow(i);
    }
  }
});
</textarea>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.yuicoder.com/2009/11/yui-datatable-context-menu-with-selectunselect-all-rows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple YUI Login using Ajax, Cookies and server side auth</title>
		<link>http://www.yuicoder.com/2009/10/simple-yui-login-using-ajax-cookies-and-server-side-auth/</link>
		<comments>http://www.yuicoder.com/2009/10/simple-yui-login-using-ajax-cookies-and-server-side-auth/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 19:23:09 +0000</pubDate>
		<dc:creator>Jeffrey Cobb</dc:creator>
				<category><![CDATA[YUI Mish Mash]]></category>

		<guid isPermaLink="false">http://www.yuicoder.com/?p=150</guid>
		<description><![CDATA[JavaScript [login.js] // set up YUI loader var loader = new YAHOO.util.YUILoader({ require: ["container","connection", "cookie", "animation", "button", "dom","event" ], loadOptional: true, onSuccess: function() { Yevent = YAHOO.util.Event; Yconnect = YAHOO.util.Connect; Ydom = YAHOO.util.Dom; Ycook = YAHOO.util.Cookie; // fire of init() function once the document has finished loading and the dom is ready YAHOO.util.Event.onDOMReady(init); }, timeout: [...]]]></description>
			<content:encoded><![CDATA[<h2>JavaScript [login.js]</h2>
<p></p>
<pre>
<textarea name="code" class="JavaScript" cols="60" rows="10">
// set up YUI loader
var loader = new YAHOO.util.YUILoader({
    require: ["container","connection",
              "cookie",
              "animation",
              "button",
              "dom","event"
              ],
   loadOptional: true,
   onSuccess: function() {
	Yevent = YAHOO.util.Event;
	Yconnect = YAHOO.util.Connect;
	Ydom = YAHOO.util.Dom;
	Ycook = YAHOO.util.Cookie;
// fire of init() function once the document has finished loading and the dom is ready
    YAHOO.util.Event.onDOMReady(init);
	},
	timeout: 10000,
	allowRollup: true,
	base: '/scripts/yui/build/',
	combine: false
});
loader.insert();

function init() {

 // Create a dialog box to put the login form into
  	    stdDialog = new YAHOO.widget.SimpleDialog("dlgstd", {
	    width: "auto",
	    fixedcenter:true,
	    modal:false,
	    visible:false,
	    close: false,
	    constraintoviewport: true
	  });
	     stdDialog.setHeader("Login:");
	     stdDialog.render(document.body);

  var buttons=[{ text:"Login", handler: function(){
  var loginCallback = {
       cache:false,
       success: function(o){
         response = o.responseText.split(",");
         if(response[0] == "ok"){
          stdDialog.setHeader("Login: Success");
          YAHOO.util.Cookie.set(response[1], response[2], {});
document.location.href = "dashboard.pl";
						}
						else {
							stdDialog.setHeader("Login: Failed, Please Try Again");
						}
	    				},
	    				failure: function(o){
	    					alert('ERROR! Connection to server failed! Please try again.');
	    					}
	    		    };
		var formObject = document.getElementById('login');
		YAHOO.util.Connect.setForm(formObject);
		var username = formObject.username.value;
		var password = formObject.password.value;
		if(username == ""){
			stdDialog.setHeader("Login: Username field is empty");
			var error = 1;
		}
		else if(password == ""){
			stdDialog.setHeader("Login: Password field is empty");
			var error = 1;
		}
		if(!error){
		var cObj = YAHOO.util.Connect.asyncRequest('POST', 'login.pl', loginCallback);
		}

	}, isDefault:true }];
		stdDialog.cfg.setProperty("buttons", buttons);
		stdDialog.cfg.setProperty("postmethod", 'async');
	    stdDialog.cfg.setProperty("text",'
<form id=login method=post action=login.pl>
<table>
<tr>
<td><b>Username:</b></td>
<td>
<input type=text name=username id=username></td>
</tr>
<tr>
<td><b>Password:</b></td>
<td>
<input type=password name=password id=pass>
<input type=hidden name=action value=login></td>
</tr>
</table>
</form>

');

		stdDialog.show();

}
</textarea>
</pre>
<h2>Perl Script [login.pl]</h2>
<pre>
<textarea name="code" class="JavaScript" cols="60" rows="10">
#!/usr/bin/perl
use CGI qw(:standard);
$query = new CGI;

if($query->param('action') eq 'login'){
print "Context-type: text/html \n\n";
# Here is where we define the username and password for authent
 if($query->param('username') eq 'username' &#038;&#038; $query->param('password') eq 'password'){
 print "ok,someRandomKeyShouldGoHere," . $query->param('username');
 }
 else {
  print "no";
 }
 exit;
}

  print header;
  print start_html(-title=>'Login',
                   -style=>{src=>'/scripts/yui/build/fonts/fonts.css'},
                   -script=>[{-type => 'text/javascript',-src =>'yui/build/yuiloader/yuiloader-min.js'},
{-type => 'text/javascript',-src =>'login.js'}],
                   -class=>'yui-skin-sam'
                   );
 print end_html;
</textarea>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.yuicoder.com/2009/10/simple-yui-login-using-ajax-cookies-and-server-side-auth/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>YUI TreeView with Drag and Drop nodes</title>
		<link>http://www.yuicoder.com/2009/07/yui-treeview-with-drag-and-drop-nodes/</link>
		<comments>http://www.yuicoder.com/2009/07/yui-treeview-with-drag-and-drop-nodes/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 19:38:28 +0000</pubDate>
		<dc:creator>Jeffrey Cobb</dc:creator>
				<category><![CDATA[YUI Mish Mash]]></category>

		<guid isPermaLink="false">http://www.yuicoder.com/2009/07/yui-treeview-with-drag-and-drop-nodes/</guid>
		<description><![CDATA[Andy created a very and useful advanced example of using the Yahoo! User Interface TreeView with the capabilites of drag and drop of child nodes to other parent nodes. Here is an exert of his blog and the link. $coderfoo: YUI TreeView with Drag and Drop nodes I recently had a need for a YUI [...]]]></description>
			<content:encoded><![CDATA[<p>Andy created a very and useful advanced example of using the Yahoo! User Interface TreeView with the capabilites of drag and drop of child nodes to other parent nodes. Here is an exert of his blog and the link.</p>
<fieldset>
<legend>
<a href="http://www.coderfoo.com/blog" target="_blank">$coderfoo</a>: <a title="YUI TreeView with Drag and Drop nodes" href="http://www.coderfoo.com/blog/2009/07/yui-treeview-with-drag-and-drop-nodes.html" target="_blank">YUI TreeView with Drag and Drop nodes</a><br />
</legend>
<p>I recently had a need for a YUI (Yahoo User Interface) TreeView with Drag &amp; Drop nodes.  Here&#8217;s a little background on the project.  My web application uses YUI Menu for navigation and is driven by a single database table.  Initially I threw together a quick and dirty CGI CRUD interface to manage the menu.  But, the more I had to modify the menu with this interface the more I needed something easier to use.  So I decided to scrap the CGI interface and start over with a nice 100% Ajax interface with a YUI TreeView to represent the YUI Menu.  Adding, changing, and deleting nodes is pretty easy, but to easily change the order of the Menu items, I added YUI Drag &amp; Drop to the TreeView&#8230;..<a title="YUI TreeView with Drag and Drop nodes" href="http://www.coderfoo.com/blog/2009/07/yui-treeview-with-drag-and-drop-nodes.html" target="_blank">[MORE]</a><br />
</fieldset>
]]></content:encoded>
			<wfw:commentRss>http://www.yuicoder.com/2009/07/yui-treeview-with-drag-and-drop-nodes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YUICalendar Helper: Creating YUI calendars using just a class name</title>
		<link>http://www.yuicoder.com/2009/07/yuicalendar-helper-creating-yui-calendars-using-just-a-class-name/</link>
		<comments>http://www.yuicoder.com/2009/07/yuicalendar-helper-creating-yui-calendars-using-just-a-class-name/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 13:35:52 +0000</pubDate>
		<dc:creator>Jeffrey Cobb</dc:creator>
				<category><![CDATA[YUI Calendar]]></category>
		<category><![CDATA[Calendar]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.yuicoder.com/?p=94</guid>
		<description><![CDATA[We have all had to create calendar pop up and usually the first thing that comes to mind is &#8220;Which calendar pop-up application am i going to use?&#8221; Well, YUI certainly makes it an easy decision because it looks good and is fairly easy to create. So when the need arose to create a form [...]]]></description>
			<content:encoded><![CDATA[<p>We have all had to create calendar pop up and usually the first thing that comes to mind is &#8220;Which calendar pop-up application am i going to use?&#8221; Well, YUI certainly makes it an easy decision because it looks good and is fairly easy to create. So when the need arose to create a form which had multiple calendar controls in it (15 to be exact), I found my-self in the need of creating a way to build these calendars with-out coding and configuring these fields by hand. So that being said <a class="yshortcuts" title="YUICalendar.js Code Rep" href="http://code.google.com/p/yuicalendar" target="_blank">YUICalendar.js</a> was created out of this need.</p>
<p>With YUICalendar.js you can include the file and simply specify a class name to an imput field and instantly produce a pop-up calendar. Check out the project page on Google at http://code.google.com/yuicalendar/ for more details.</p>
<p>Here is a working example: <a class="yshortcuts" title="Working Example of YUICalendar.js" href="http://yuicoder.com/examples/YUICalendar/example.html" target="_blank">EXAMPLE</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yuicoder.com/2009/07/yuicalendar-helper-creating-yui-calendars-using-just-a-class-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a FIXED element with re-size and scroll detection using YUI dom and event</title>
		<link>http://www.yuicoder.com/2009/03/creating-a-fixed-element-with-re-size-and-scroll-detection-using-yui-dom-and-event/</link>
		<comments>http://www.yuicoder.com/2009/03/creating-a-fixed-element-with-re-size-and-scroll-detection-using-yui-dom-and-event/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 00:05:05 +0000</pubDate>
		<dc:creator>Jeffrey Cobb</dc:creator>
				<category><![CDATA[YUI Loader]]></category>
		<category><![CDATA[YUI Mish Mash]]></category>
		<category><![CDATA[YUI Util DOM]]></category>
		<category><![CDATA[createElement]]></category>
		<category><![CDATA[Get]]></category>
		<category><![CDATA[getPreviousSibling()]]></category>
		<category><![CDATA[getViewPortHeight()]]></category>
		<category><![CDATA[getViewPortWidth()]]></category>
		<category><![CDATA[inDocument()]]></category>
		<category><![CDATA[insertAfter]]></category>
		<category><![CDATA[setStyle()]]></category>
		<category><![CDATA[window.resize]]></category>
		<category><![CDATA[YAHOO.Dom.Event]]></category>
		<category><![CDATA[YAHOO.util.Event.addListner]]></category>
		<category><![CDATA[YUI Event]]></category>

		<guid isPermaLink="false">http://www.yuicoder.com/?p=85</guid>
		<description><![CDATA[We have all see them and some of us love them. It&#8217;s those elements that seem to float on the page like hovering little angels. Ok enough with the sappy crap&#8230;down to business. So you need to create a browser independent simple script to position an element on a page. I put together a simple [...]]]></description>
			<content:encoded><![CDATA[<p>We have all see them and some of us love them. It&#8217;s those elements that seem to float on the page like hovering little angels. Ok enough with the sappy crap&#8230;down to business. So you need to create a browser independent simple script to position an element on a page. I put together a simple script that will handle such a task and is flexible enough for even a newbie to configure. </p>
<p>In this example my task is to create a footer element that will stay on the bottom of the browser window during re-size and scroll events.<a href="http://yuicoder.com/examples/fixedFooter.html" target="blank">View the completed project</a>\n</p>
<h2>CSS</h2>
<p>First you will need to specify the position and size of your element.</p>
<pre>
<textarea name="code" class="css" cols="60" rows="10">#screenFooter {
  position: absolute;
	left: 0px;
	top: 0px;
	width: 100%;
	height: 25px;}
</textarea>
</pre>
<h2>HTML</h2>
<p>Assign your element an ID!</p>
<pre>
<textarea name="code" class="html" cols="60" rows="10">
<div id="screenFooter">YuiCoder.com</div>

</textarea>
</pre>
<h2>Javascript</h2>
<p>Insert the following code to the bottom of the page just before the body tag.<br />
In this example I am using the YUI Loader to speed up deployment of my examples. You do not need to user YUI Loader but remember you will need to load the yahoo, dom and event scripts from the YUI Library in order for this to work.</p>
<pre>
<textarea name="code" class="javascript" cols="60" rows="10">
<!--
var loader = new YAHOO.util.YUILoader({
    require: ["dom","event"],
    loadOptional: true,
    onSuccess: function() {
    Ydom = YAHOO.util.Dom;

// Start LoadFooter Code
// Fires of the LoadFooter function when the browser dom is ready
Yevent.onDOMReady(LoadFooter);

// Scroll event listner
YAHOO.util.Event.addListener(window, 'scroll',
    function(){
       var Ydom = YAHOO.util.Dom;
       Ydom.setStyle(Ydom.get('screenFooter'),'visibility','hidden');
       LoadFooter();
      }
);

YAHOO.util.Event.addListener(window, 'resize', LoadFooter );
},
    timeout: 10000,
    combine: true
});
loader.insert();

function LoadFooter(){
// Get the footer element as an object
var footer = Ydom.get('screenFooter');
// Get the element loaded BEFORE the footer
var footer2 = Ydom.getPreviousSibling(footer);

    // Create an element just before the footer. This will ensure the footer does not hide anything
	//on the bottom of your page
    if(!Ydom.inDocument('footerBreak') ){
      var b = document.createElement('div');
          b.style.height = '37px';
          b.id = 'footerBreak';
       Ydom.insertAfter(b,footer2);
    }

    // Get the document scroll TOP position
    var sfS = Ydom.getDocumentScrollTop();
	// Get the document ViewPort size - subtract the footer size then add the scroll top position
    var sfH = Ydom.getViewportHeight() - 37 + sfS;
	// Note if you are dealing with an element that is smaller than 100% of the document viewport
	// add calculations for the getViewportWidth() for horizonal scrolling detection

	// Here we set the style properties of the footer
    Ydom.setStyle(footer,'position','absolute');
    Ydom.setStyle(footer,'top',sfH+'px');
    Ydom.setStyle(footer,'visibility','visible');
}

-->
</textarea>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.yuicoder.com/2009/03/creating-a-fixed-element-with-re-size-and-scroll-detection-using-yui-dom-and-event/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Inserting a new element before the end body tag using Yahoo Util DOM</title>
		<link>http://www.yuicoder.com/2009/03/inserting-a-new-element-before-the-end-body-tag-using-yahoo-util-dom/</link>
		<comments>http://www.yuicoder.com/2009/03/inserting-a-new-element-before-the-end-body-tag-using-yahoo-util-dom/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 13:25:02 +0000</pubDate>
		<dc:creator>Jeffrey Cobb</dc:creator>
				<category><![CDATA[YUI Util DOM]]></category>
		<category><![CDATA[createElement]]></category>
		<category><![CDATA[generateID]]></category>
		<category><![CDATA[getElementsByClassName]]></category>
		<category><![CDATA[getLastChild]]></category>
		<category><![CDATA[insertAfter]]></category>
		<category><![CDATA[YAHOO.Util.Dom]]></category>

		<guid isPermaLink="false">http://www.yuicoder.com/?p=79</guid>
		<description><![CDATA[An example of how to create elements in javascript then attach/append them to other elements using YUI.]]></description>
			<content:encoded><![CDATA[<p>Creating elements like divs, href links, paragraphs and more can be tricky. Suppose you do not have access to modify the html or you are dealing with a template file that is static to the entire application and need to add an element to the page on the fly. Using the YUI DOM utility you can do this simply by searching for an element by class name or id then appending the element to the page just where you want it. The code below gives you an example of how to use the getElementsByClassName method in YUI by searching for a body element with the class name of yui-skin-sam. Check out the YUI api for more helper methods.</p>
<pre name="code" class="JavaScript">
//lets find the elements we need by finding all body elements that have the class yui-skin-sam
var elements = YAHOO.util.Dom.getElementsByClassName('yui-skin-sam', 'body');
//if you body does not have an ID then generate one usign the generateID method.
    var bodyid = YAHOO.util.Dom.generateId(elements[0],'body');
// Get the last child element of the body by searching for the body id we just created above.
    var bodyLastChild = YAHOO.util.Dom.getLastChild(bodyid);

// Now we create a DIV element using the standard javascript method createElement
		var b = document.createElement('div');
// Let YUI create and assign the new div elements id.
		var bottomid = YAHOO.util.Dom.generateId(b,'bottom');
    	b.href='#';
// Put some html in your div
		b.innerHTML = 'TESTER';
// Assign your div a class name of newClass so you can reference it in a style sheet.
		b.className = 'newClass';
// Attach the new DIV id to the element you are creating
		b.id = bottomid;
// Use YUI to insert the new div element afer the last child element of the body tag.
		YAHOO.util.Dom.insertAfter(b ,YAHOO.util.Dom.get(bodyLastChild));
</pre>
<p>Now to learn more on how to create ELEMENTS like divs and paragraphs check out the tutorials at W3cshools. This is sure to be a fun project to play and learn. Give it a try!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yuicoder.com/2009/03/inserting-a-new-element-before-the-end-body-tag-using-yahoo-util-dom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding up column data in the YUI Datatable</title>
		<link>http://www.yuicoder.com/2009/03/adding-up-column-data-in-the-yui-datatable/</link>
		<comments>http://www.yuicoder.com/2009/03/adding-up-column-data-in-the-yui-datatable/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 15:45:59 +0000</pubDate>
		<dc:creator>Jeffrey Cobb</dc:creator>
				<category><![CDATA[YUI Datatable]]></category>

		<guid isPermaLink="false">http://www.yuicoder.com/?p=74</guid>
		<description><![CDATA[At times it becomes necessary to add up the data with in a column. Here is a nice little snippet that can do just that. Change DATATABLE with the name of the data table you need to read. Change COLUMNNAME with the column key in the table you need to read. // First get the [...]]]></description>
			<content:encoded><![CDATA[<p>At times it becomes necessary to add up the data with in a column. Here is a nice little snippet that can do just that.<br />
Change <em>DATATABLE</em> with the name of the data table you need to read.<br />
Change <em>COLUMNNAME</em> with the column key in the table you need to read.</p>
<pre name="code" class="JavaScript">
// First get the record set from the datatable.
var records = DATATABLE.getRecordSet();

// Let's count how many records we found
var len = records._records.length-1;
var total = 0;
// Loop through the record set getting the data from the coulumn and setting its value to "value"

for(i=0;i<=len;i++){
 //create the value you need so you can handle the data
var value = records._records[i]._oData.COLUMNNAME;
// now all you need to do is add up your values
total+=value;
}
//log it to the FireBug console
console.log(total);
</pre>
<p>Once you have found the value for the column from that point you can manipulate the data to your will.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yuicoder.com/2009/03/adding-up-column-data-in-the-yui-datatable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>
]]></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>

