

<?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>Michael Hartmayer &#187; JavaScript</title>
	<atom:link href="http://www.michaelhartmayer.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.michaelhartmayer.com</link>
	<description>Portfolio of an Idea Crafter</description>
	<lastBuildDate>Fri, 16 Sep 2011 19:52:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Canvas Tile System</title>
		<link>http://www.michaelhartmayer.com/javascript/canvas-tile-system/</link>
		<comments>http://www.michaelhartmayer.com/javascript/canvas-tile-system/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 05:38:42 +0000</pubDate>
		<dc:creator>Michael Hartmayer</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.michaelhartmayer.com/?p=635</guid>
		<description><![CDATA[Here&#8217;s something quick that I put together to see how easily I could create a Tile System (as in 2d sprite map for games) using JavaScript and Canvas. First I set out to create a system for loading, caching, and retrieving the tiles. Here&#8217;s what I came up with: // Allows you to load image [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s something quick that I put together to see how easily I could create a Tile System (as in 2d sprite map for games) using JavaScript and Canvas.</p>
<p>First I set out to create a system for loading, caching, and retrieving the tiles. Here&#8217;s what I came up with:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// Allows you to load image sprite and then make cached tiles</span>
<span style="color: #006600; font-style: italic;">// that can be retrieved</span>
<span style="color: #003366; font-weight: bold;">var</span> TileLibrary <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>img<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> oTileLibrary <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      elCanvas <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'canvas'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      cxCanvas <span style="color: #339933;">=</span> elCanvas.<span style="color: #660066;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'2d'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  elCanvas.<span style="color: #660066;">width</span>  <span style="color: #339933;">=</span> img.<span style="color: #660066;">width</span><span style="color: #339933;">;</span>
  elCanvas.<span style="color: #660066;">height</span> <span style="color: #339933;">=</span> img.<span style="color: #660066;">height</span><span style="color: #339933;">;</span>
  cxCanvas.<span style="color: #660066;">drawImage</span><span style="color: #009900;">&#40;</span>img<span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> img.<span style="color: #660066;">width</span><span style="color: #339933;">,</span> img.<span style="color: #660066;">height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>
    makeType<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span><span style="color: #339933;">,</span> x<span style="color: #339933;">,</span> y<span style="color: #339933;">,</span> width<span style="color: #339933;">,</span> height<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      oTileLibrary<span style="color: #009900;">&#91;</span><span style="color: #000066;">name</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> cxCanvas.<span style="color: #660066;">getImageData</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">,</span> y<span style="color: #339933;">,</span> width<span style="color: #339933;">,</span> height<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    getTileData<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> oTileLibrary<span style="color: #009900;">&#91;</span><span style="color: #000066;">name</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>&nbsp;</p>
<p>This allows me to take an <em>Image</em> object and turn pieces of it into data that canvas can understand. Usage would look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// img is a preloaded image object</span>
<span style="color: #003366; font-weight: bold;">var</span> oTileLibrary <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> TileLibrary<span style="color: #009900;">&#40;</span>img<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// cuts out a chunk of the image at (0, 0) with dimensions 64x64 and caches it</span>
oTileLibrary.<span style="color: #660066;">makeType</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;FloorTile&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">64</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">64</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// gets the ImageData out of cache and ready to be dumped into a canvas</span>
<span style="color: #003366; font-weight: bold;">var</span> tFloorTile <span style="color: #339933;">=</span> oTileLibrary.<span style="color: #660066;">getTileData</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;FloorTile&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// inserts that floor tile into its final destination</span>
myCanvas.<span style="color: #660066;">putImageData</span><span style="color: #009900;">&#40;</span>tFloorTile<span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>&nbsp;</p>
<p>I ended up borrowing this image for my prototype:<br />
<img src="http://playground.michaelhartmayer.com/f/prototypes/canvas-tile-system/tiles/desert.jpg" alt="Desert Sprite Map" /></p>
<p>( http://www.lostgarden.com/2006/02/250-free-handdrawn-textures.html )</p>
<p>&nbsp;</p>
<p>I cut out the <strong>third</strong> tile and the <strong>fourth</strong> tile, and arranged them in a 3&#215;3 grid, with the middle tile being the little circle looking thing.</p>
<p>Check out the sample here: <a title="Tile System Prototype" href="http://playground.michaelhartmayer.com/f/prototypes/canvas-tile-system/" target="_blank">Tile System Prototype</a></p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-tile-system%2F&amp;title=Canvas%20Tile%20System&amp;bodytext=Here%27s%20something%20quick%20that%20I%20put%20together%20to%20see%20how%20easily%20I%20could%20create%20a%20Tile%20System%20%28as%20in%202d%20sprite%20map%20for%20games%29%20using%20JavaScript%20and%20Canvas.%0D%0A%0D%0AFirst%20I%20set%20out%20to%20create%20a%20system%20for%20loading%2C%20caching%2C%20and%20retrieving%20the%20tiles.%20Here%27s%20what%20I" title="Digg"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-tile-system%2F" title="Sphinn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-tile-system%2F&amp;title=Canvas%20Tile%20System&amp;notes=Here%27s%20something%20quick%20that%20I%20put%20together%20to%20see%20how%20easily%20I%20could%20create%20a%20Tile%20System%20%28as%20in%202d%20sprite%20map%20for%20games%29%20using%20JavaScript%20and%20Canvas.%0D%0A%0D%0AFirst%20I%20set%20out%20to%20create%20a%20system%20for%20loading%2C%20caching%2C%20and%20retrieving%20the%20tiles.%20Here%27s%20what%20I" title="del.icio.us"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-tile-system%2F&amp;t=Canvas%20Tile%20System" title="Facebook"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-tile-system%2F&amp;title=Canvas%20Tile%20System" title="Mixx"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-tile-system%2F&amp;title=Canvas%20Tile%20System&amp;annotation=Here%27s%20something%20quick%20that%20I%20put%20together%20to%20see%20how%20easily%20I%20could%20create%20a%20Tile%20System%20%28as%20in%202d%20sprite%20map%20for%20games%29%20using%20JavaScript%20and%20Canvas.%0D%0A%0D%0AFirst%20I%20set%20out%20to%20create%20a%20system%20for%20loading%2C%20caching%2C%20and%20retrieving%20the%20tiles.%20Here%27s%20what%20I" title="Google Bookmarks"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-tile-system%2F&amp;title=Canvas%20Tile%20System&amp;source=Michael+Hartmayer+Portfolio+of+an+Idea+Crafter&amp;summary=Here%27s%20something%20quick%20that%20I%20put%20together%20to%20see%20how%20easily%20I%20could%20create%20a%20Tile%20System%20%28as%20in%202d%20sprite%20map%20for%20games%29%20using%20JavaScript%20and%20Canvas.%0D%0A%0D%0AFirst%20I%20set%20out%20to%20create%20a%20system%20for%20loading%2C%20caching%2C%20and%20retrieving%20the%20tiles.%20Here%27s%20what%20I" title="LinkedIn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-tile-system%2F&amp;title=Canvas%20Tile%20System" title="Live"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-tile-system%2F&amp;t=Canvas%20Tile%20System" title="MySpace"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-tile-system%2F&amp;title=Canvas%20Tile%20System" title="Reddit"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-tile-system%2F&amp;title=Canvas%20Tile%20System" title="StumbleUpon"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelhartmayer.com/javascript/canvas-tile-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Canvas Pixel Manipulation a&#8217; la Quick and Dirty</title>
		<link>http://www.michaelhartmayer.com/javascript/canvas-pixel-manipulation-a-la-quick-and-dirty/</link>
		<comments>http://www.michaelhartmayer.com/javascript/canvas-pixel-manipulation-a-la-quick-and-dirty/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 16:50:17 +0000</pubDate>
		<dc:creator>Michael Hartmayer</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.michaelhartmayer.com/?p=632</guid>
		<description><![CDATA[In a recent prototype I attempted to load in a PNG onto a canvas, change the image to a silhouette, as well as create a desaturated version, cache all three (including the initial state) sets of pixel data, and swap them out interchangeably. Then I wanted to spit the data back out into something I [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent prototype I attempted to load in a PNG onto a canvas, change the image to a silhouette, as well as create a desaturated version, cache all three (including the initial state) sets of pixel data, and swap them out interchangeably. Then I wanted to spit the data back out into something I could incorporate into the DOM.</p>
<p>Here&#8217;s what I came up with: <a title="Canvas Pixel Manipulation" href="http://playground.michaelhartmayer.com/f/wip11/ios/proto/canvas/" target="_blank">Canvas Pixel Manipulation</a></p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-pixel-manipulation-a-la-quick-and-dirty%2F&amp;title=Canvas%20Pixel%20Manipulation%20a%27%20la%20Quick%20and%20Dirty&amp;bodytext=In%20a%20recent%20prototype%20I%20attempted%20to%20load%20in%20a%20PNG%20onto%20a%20canvas%2C%20change%20the%20image%20to%20a%20silhouette%2C%20as%20well%20as%20create%20a%20desaturated%20version%2C%20cache%20all%20three%20%28including%20the%20initial%20state%29%20sets%20of%20pixel%20data%2C%20and%20swap%20them%20out%20interchangeably.%20Then%20I%20w" title="Digg"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-pixel-manipulation-a-la-quick-and-dirty%2F" title="Sphinn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-pixel-manipulation-a-la-quick-and-dirty%2F&amp;title=Canvas%20Pixel%20Manipulation%20a%27%20la%20Quick%20and%20Dirty&amp;notes=In%20a%20recent%20prototype%20I%20attempted%20to%20load%20in%20a%20PNG%20onto%20a%20canvas%2C%20change%20the%20image%20to%20a%20silhouette%2C%20as%20well%20as%20create%20a%20desaturated%20version%2C%20cache%20all%20three%20%28including%20the%20initial%20state%29%20sets%20of%20pixel%20data%2C%20and%20swap%20them%20out%20interchangeably.%20Then%20I%20w" title="del.icio.us"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-pixel-manipulation-a-la-quick-and-dirty%2F&amp;t=Canvas%20Pixel%20Manipulation%20a%27%20la%20Quick%20and%20Dirty" title="Facebook"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-pixel-manipulation-a-la-quick-and-dirty%2F&amp;title=Canvas%20Pixel%20Manipulation%20a%27%20la%20Quick%20and%20Dirty" title="Mixx"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-pixel-manipulation-a-la-quick-and-dirty%2F&amp;title=Canvas%20Pixel%20Manipulation%20a%27%20la%20Quick%20and%20Dirty&amp;annotation=In%20a%20recent%20prototype%20I%20attempted%20to%20load%20in%20a%20PNG%20onto%20a%20canvas%2C%20change%20the%20image%20to%20a%20silhouette%2C%20as%20well%20as%20create%20a%20desaturated%20version%2C%20cache%20all%20three%20%28including%20the%20initial%20state%29%20sets%20of%20pixel%20data%2C%20and%20swap%20them%20out%20interchangeably.%20Then%20I%20w" title="Google Bookmarks"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-pixel-manipulation-a-la-quick-and-dirty%2F&amp;title=Canvas%20Pixel%20Manipulation%20a%27%20la%20Quick%20and%20Dirty&amp;source=Michael+Hartmayer+Portfolio+of+an+Idea+Crafter&amp;summary=In%20a%20recent%20prototype%20I%20attempted%20to%20load%20in%20a%20PNG%20onto%20a%20canvas%2C%20change%20the%20image%20to%20a%20silhouette%2C%20as%20well%20as%20create%20a%20desaturated%20version%2C%20cache%20all%20three%20%28including%20the%20initial%20state%29%20sets%20of%20pixel%20data%2C%20and%20swap%20them%20out%20interchangeably.%20Then%20I%20w" title="LinkedIn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-pixel-manipulation-a-la-quick-and-dirty%2F&amp;title=Canvas%20Pixel%20Manipulation%20a%27%20la%20Quick%20and%20Dirty" title="Live"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-pixel-manipulation-a-la-quick-and-dirty%2F&amp;t=Canvas%20Pixel%20Manipulation%20a%27%20la%20Quick%20and%20Dirty" title="MySpace"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-pixel-manipulation-a-la-quick-and-dirty%2F&amp;title=Canvas%20Pixel%20Manipulation%20a%27%20la%20Quick%20and%20Dirty" title="Reddit"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fcanvas-pixel-manipulation-a-la-quick-and-dirty%2F&amp;title=Canvas%20Pixel%20Manipulation%20a%27%20la%20Quick%20and%20Dirty" title="StumbleUpon"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelhartmayer.com/javascript/canvas-pixel-manipulation-a-la-quick-and-dirty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Timer Countdown</title>
		<link>http://www.michaelhartmayer.com/javascript/javascript-timer-countdown/</link>
		<comments>http://www.michaelhartmayer.com/javascript/javascript-timer-countdown/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 16:51:26 +0000</pubDate>
		<dc:creator>Michael Hartmayer</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[countdown]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[timer]]></category>

		<guid isPermaLink="false">http://www.michaelhartmayer.com/?p=601</guid>
		<description><![CDATA[Working on a new game. Wrote this TimerCountdown object for a Timer in the game. Works pretty well, still not fully tested. var TimerCountdown = function&#40;&#41; &#123; var oOnZero = function&#40;&#41;&#123;&#125;, oOnUpdate = function&#40;&#41;&#123;&#125;, oTimer, iCurTime = 0; &#160; function CreateTimer&#40;&#41; &#123; oTimer = setInterval&#40;IterateTimer, 1000&#41; &#125; &#160; function DestroyTimer&#40;&#41; &#123; clearInterval&#40; oTimer &#41;; &#125; [...]]]></description>
			<content:encoded><![CDATA[<p>Working on a new game. Wrote this TimerCountdown object for a Timer in the game. Works pretty well, still not fully tested.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> TimerCountdown <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> oOnZero     <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      oOnUpdate   <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      oTimer<span style="color: #339933;">,</span>
      iCurTime    <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #003366; font-weight: bold;">function</span> CreateTimer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    oTimer <span style="color: #339933;">=</span> setInterval<span style="color: #009900;">&#40;</span>IterateTimer<span style="color: #339933;">,</span> <span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #003366; font-weight: bold;">function</span> DestroyTimer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    clearInterval<span style="color: #009900;">&#40;</span> oTimer <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #003366; font-weight: bold;">function</span> IterateTimer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    iCurTime <span style="color: #339933;">=</span> iCurTime <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
    oOnUpdate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
      Seconds<span style="color: #339933;">:</span> iCurTime<span style="color: #339933;">,</span>
      Minutes<span style="color: #339933;">:</span> parseInt<span style="color: #009900;">&#40;</span> iCurTime <span style="color: #339933;">/</span> <span style="color: #CC0000;">60</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      Hours<span style="color: #339933;">:</span> parseInt<span style="color: #009900;">&#40;</span> iCurTime <span style="color: #009966; font-style: italic;">/ 60 /</span> <span style="color: #CC0000;">60</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> iCurTime <span style="color: #339933;">&lt;=</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      DestroyTimer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      oOnZero<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>
    SetTime<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> iSeconds <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      iCurTime <span style="color: #339933;">=</span> iSeconds<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    Start<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      CreateTimer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #000066;">Stop</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      DestroyTimer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    Time<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> iCurTime<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    Add<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> iSeconds <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      iCurTime <span style="color: #339933;">=</span> iCurTime <span style="color: #339933;">+</span> iSeconds<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    Subtract<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> iSeconds <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      iCurTime <span style="color: #339933;">=</span> iCurTime <span style="color: #339933;">-</span> iSeconds<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    OnUpdate<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> cbFunction <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      oOnUpdate <span style="color: #339933;">=</span> cbFunction<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    OnZero<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> cbFunction <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      oOnZero <span style="color: #339933;">=</span> cbFunction<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-timer-countdown%2F&amp;title=JavaScript%20Timer%20Countdown&amp;bodytext=Working%20on%20a%20new%20game.%20Wrote%20this%20TimerCountdown%20object%20for%20a%20Timer%20in%20the%20game.%20Works%20pretty%20well%2C%20still%20not%20fully%20tested.%0D%0A%0D%0A%0D%0Avar%20TimerCountdown%20%3D%20function%28%29%20%7B%0D%0A%20%20var%20oOnZero%20%20%20%20%20%3D%20function%28%29%7B%7D%2C%0D%0A%20%20%20%20%20%20oOnUpdate%20%20%20%3D%20function%28%29%7B%7D%2C%0D%0A%20%20%20%20%20%20oTimer%2C%0D%0A%20" title="Digg"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-timer-countdown%2F" title="Sphinn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-timer-countdown%2F&amp;title=JavaScript%20Timer%20Countdown&amp;notes=Working%20on%20a%20new%20game.%20Wrote%20this%20TimerCountdown%20object%20for%20a%20Timer%20in%20the%20game.%20Works%20pretty%20well%2C%20still%20not%20fully%20tested.%0D%0A%0D%0A%0D%0Avar%20TimerCountdown%20%3D%20function%28%29%20%7B%0D%0A%20%20var%20oOnZero%20%20%20%20%20%3D%20function%28%29%7B%7D%2C%0D%0A%20%20%20%20%20%20oOnUpdate%20%20%20%3D%20function%28%29%7B%7D%2C%0D%0A%20%20%20%20%20%20oTimer%2C%0D%0A%20" title="del.icio.us"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-timer-countdown%2F&amp;t=JavaScript%20Timer%20Countdown" title="Facebook"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-timer-countdown%2F&amp;title=JavaScript%20Timer%20Countdown" title="Mixx"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-timer-countdown%2F&amp;title=JavaScript%20Timer%20Countdown&amp;annotation=Working%20on%20a%20new%20game.%20Wrote%20this%20TimerCountdown%20object%20for%20a%20Timer%20in%20the%20game.%20Works%20pretty%20well%2C%20still%20not%20fully%20tested.%0D%0A%0D%0A%0D%0Avar%20TimerCountdown%20%3D%20function%28%29%20%7B%0D%0A%20%20var%20oOnZero%20%20%20%20%20%3D%20function%28%29%7B%7D%2C%0D%0A%20%20%20%20%20%20oOnUpdate%20%20%20%3D%20function%28%29%7B%7D%2C%0D%0A%20%20%20%20%20%20oTimer%2C%0D%0A%20" title="Google Bookmarks"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-timer-countdown%2F&amp;title=JavaScript%20Timer%20Countdown&amp;source=Michael+Hartmayer+Portfolio+of+an+Idea+Crafter&amp;summary=Working%20on%20a%20new%20game.%20Wrote%20this%20TimerCountdown%20object%20for%20a%20Timer%20in%20the%20game.%20Works%20pretty%20well%2C%20still%20not%20fully%20tested.%0D%0A%0D%0A%0D%0Avar%20TimerCountdown%20%3D%20function%28%29%20%7B%0D%0A%20%20var%20oOnZero%20%20%20%20%20%3D%20function%28%29%7B%7D%2C%0D%0A%20%20%20%20%20%20oOnUpdate%20%20%20%3D%20function%28%29%7B%7D%2C%0D%0A%20%20%20%20%20%20oTimer%2C%0D%0A%20" title="LinkedIn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-timer-countdown%2F&amp;title=JavaScript%20Timer%20Countdown" title="Live"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-timer-countdown%2F&amp;t=JavaScript%20Timer%20Countdown" title="MySpace"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-timer-countdown%2F&amp;title=JavaScript%20Timer%20Countdown" title="Reddit"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-timer-countdown%2F&amp;title=JavaScript%20Timer%20Countdown" title="StumbleUpon"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelhartmayer.com/javascript/javascript-timer-countdown/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Replace All</title>
		<link>http://www.michaelhartmayer.com/javascript/javascript-replace-all/</link>
		<comments>http://www.michaelhartmayer.com/javascript/javascript-replace-all/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 21:47:15 +0000</pubDate>
		<dc:creator>Michael Hartmayer</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.michaelhartmayer.com/?p=585</guid>
		<description><![CDATA[Here&#8217;s my version of the replaceAll() method for JavaScript. I doubt it&#8217;s faster than RegEx, but it was certainly fun to make. String.prototype.replaceAll = function&#40;s, r, n&#41; &#123; if&#40; this.toString&#40;&#41;.indexOf&#40;s&#41; &#60; n &#41; n = 0; if&#40; !n &#41; return this.toString&#40;&#41;.split&#40; s &#41;.join&#40; r &#41;; &#160; var j = this.toString&#40;&#41;; while&#40; n-- &#41; &#123; j [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s my version of the replaceAll() method for JavaScript. I doubt it&#8217;s faster than RegEx, but it was certainly fun to make. <img src='http://www.michaelhartmayer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">String.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">replaceAll</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>s<span style="color: #339933;">,</span> r<span style="color: #339933;">,</span> n<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> n <span style="color: #009900;">&#41;</span> n <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>n <span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span> s <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">join</span><span style="color: #009900;">&#40;</span> r <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> j <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span> n<span style="color: #339933;">--</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		j <span style="color: #339933;">=</span> j.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span> s<span style="color: #339933;">,</span> r <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">return</span> j<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> TestString <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;I Love My Pie So Much, Don't You?&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Usage</span>
console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span> TestString.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;o&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;*&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span> TestString.<span style="color: #660066;">replaceAll</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;o&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;*&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-replace-all%2F&amp;title=JavaScript%20Replace%20All&amp;bodytext=Here%27s%20my%20version%20of%20the%20replaceAll%28%29%20method%20for%20JavaScript.%20I%20doubt%20it%27s%20faster%20than%20RegEx%2C%20but%20it%20was%20certainly%20fun%20to%20make.%20%3A%29%0D%0A%0D%0A%0D%0AString.prototype.replaceAll%20%3D%20function%28s%2C%20r%2C%20n%29%20%7B%0D%0A%09if%28%20this.toString%28%29.indexOf%28s%29%20%3C%20n%20%29%20n%20%3D%200%3B%0D%0A%09if%28%20%21n%20%29%20return%20t" title="Digg"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-replace-all%2F" title="Sphinn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-replace-all%2F&amp;title=JavaScript%20Replace%20All&amp;notes=Here%27s%20my%20version%20of%20the%20replaceAll%28%29%20method%20for%20JavaScript.%20I%20doubt%20it%27s%20faster%20than%20RegEx%2C%20but%20it%20was%20certainly%20fun%20to%20make.%20%3A%29%0D%0A%0D%0A%0D%0AString.prototype.replaceAll%20%3D%20function%28s%2C%20r%2C%20n%29%20%7B%0D%0A%09if%28%20this.toString%28%29.indexOf%28s%29%20%3C%20n%20%29%20n%20%3D%200%3B%0D%0A%09if%28%20%21n%20%29%20return%20t" title="del.icio.us"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-replace-all%2F&amp;t=JavaScript%20Replace%20All" title="Facebook"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-replace-all%2F&amp;title=JavaScript%20Replace%20All" title="Mixx"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-replace-all%2F&amp;title=JavaScript%20Replace%20All&amp;annotation=Here%27s%20my%20version%20of%20the%20replaceAll%28%29%20method%20for%20JavaScript.%20I%20doubt%20it%27s%20faster%20than%20RegEx%2C%20but%20it%20was%20certainly%20fun%20to%20make.%20%3A%29%0D%0A%0D%0A%0D%0AString.prototype.replaceAll%20%3D%20function%28s%2C%20r%2C%20n%29%20%7B%0D%0A%09if%28%20this.toString%28%29.indexOf%28s%29%20%3C%20n%20%29%20n%20%3D%200%3B%0D%0A%09if%28%20%21n%20%29%20return%20t" title="Google Bookmarks"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-replace-all%2F&amp;title=JavaScript%20Replace%20All&amp;source=Michael+Hartmayer+Portfolio+of+an+Idea+Crafter&amp;summary=Here%27s%20my%20version%20of%20the%20replaceAll%28%29%20method%20for%20JavaScript.%20I%20doubt%20it%27s%20faster%20than%20RegEx%2C%20but%20it%20was%20certainly%20fun%20to%20make.%20%3A%29%0D%0A%0D%0A%0D%0AString.prototype.replaceAll%20%3D%20function%28s%2C%20r%2C%20n%29%20%7B%0D%0A%09if%28%20this.toString%28%29.indexOf%28s%29%20%3C%20n%20%29%20n%20%3D%200%3B%0D%0A%09if%28%20%21n%20%29%20return%20t" title="LinkedIn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-replace-all%2F&amp;title=JavaScript%20Replace%20All" title="Live"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-replace-all%2F&amp;t=JavaScript%20Replace%20All" title="MySpace"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-replace-all%2F&amp;title=JavaScript%20Replace%20All" title="Reddit"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fjavascript-replace-all%2F&amp;title=JavaScript%20Replace%20All" title="StumbleUpon"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelhartmayer.com/javascript/javascript-replace-all/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Text to Pixel Font!</title>
		<link>http://www.michaelhartmayer.com/fun/text-to-pixel-font/</link>
		<comments>http://www.michaelhartmayer.com/fun/text-to-pixel-font/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 03:19:10 +0000</pubDate>
		<dc:creator>Michael Hartmayer</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.michaelhartmayer.com/?p=513</guid>
		<description><![CDATA[So, this is a silly little proof of concept I came up with to kill 20 minutes in between projects. Takes regular text and turns it into 1px sized divs. That&#8217;s right, the div&#8217;s actually form the pixels of each letter! Awesome, right!? Check it out! jsTexty Example How&#8217;s it done? Easy: * Get the [...]]]></description>
			<content:encoded><![CDATA[<p>So, this is a silly little proof of concept I came up with to kill 20 minutes in between projects. Takes regular text and turns it into 1px sized divs. That&#8217;s right, the div&#8217;s actually form the pixels of each letter! <img src='http://www.michaelhartmayer.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Awesome, right!? Check it out!</p>
<p><a href="http://playground.michaelhartmayer.com/f/wip11/jsTexty.html" title="JavaScript Pixel Font" target="_blank">jsTexty Example</a></p>
<p>How&#8217;s it done? Easy:<br />
* Get the text of an element<br />
* Move through it, 1 character at a time<br />
* Match the character with a pattern (currently only supports lowercase)<br />
* Convert the pattern to markup<br />
* Replace the text with excessive amounts of html <img src='http://www.michaelhartmayer.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> jsTexty <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
    jsTexty.<span style="color: #660066;">Make</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> strLetterString <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> strReplaceHtml <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>strLetterString.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> strThisLetter <span style="color: #339933;">=</span> strLetterString.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> jsTexty.<span style="color: #660066;">GetLetterCode</span><span style="color: #009900;">&#40;</span>strThisLetter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                strReplaceHtml <span style="color: #339933;">+=</span> jsTexty.<span style="color: #660066;">LetterCodeToHtml</span><span style="color: #009900;">&#40;</span>arrLetterCode<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        $<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>strReplaceHtml <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
    jsTexty.<span style="color: #660066;">LetterCodeToHtml</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>arrLetterCode<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> strReplaceHtml <span style="color: #339933;">=</span> <span style="color: #3366CC;">'&lt;div class=&quot;lbBlock&quot;&gt;'</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>arrLetterCode.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> strThisRow <span style="color: #339933;">=</span> arrLetterCode<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> j <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> j<span style="color: #339933;">&lt;</span>strThisRow<span style="color: #339933;">;</span> j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003366; font-weight: bold;">var</span> strThisLetterBlock <span style="color: #339933;">=</span> strThisRow.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span>j<span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>strThisLetterBlock<span style="color: #339933;">===</span><span style="color: #3366CC;">'1'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    strReplaceHtml <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&lt;div class=&quot;lbSolid&quot;&gt;&lt;/div&gt;'</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>strThisLetterBlock<span style="color: #339933;">===</span><span style="color: #3366CC;">'0'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    strReplaceHtml <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'&lt;div class=&quot;lbEmpty&quot;&gt;&lt;/div&gt;'</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
            strReplaceHtml<span style="color: #339933;">+=</span><span style="color: #3366CC;">'&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;'</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">return</span> strReplaceHtml <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    jsTexty.<span style="color: #660066;">GetLetterCode</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>strSingleLetter<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">switch</span><span style="color: #009900;">&#40;</span>strSingleLetter<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">' '</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'0000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0000'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'a'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'0110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1111'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'b'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'1110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1110'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'c'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'0111'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0111'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'d'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'1110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1110'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'e'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'1111'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1111'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'f'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'1111'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'g'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'0111'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1011'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0111'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'h'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1111'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'i'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'111'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'111'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'j'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'0001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0110'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'k'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1100'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'l'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'1000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1111'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'m'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'10001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'11011'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'10101'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'10001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'10001'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'n'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'10001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'11001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'10101'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'10011'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'10001'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'o'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'0110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0110'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'p'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'1110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1000'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'q'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'0000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0111'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0001'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'r'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'1110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'s'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'0111'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1100'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0011'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1110'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'t'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'11111'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'00100'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'00100'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'00100'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'00100'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'u'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0110'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'v'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'10001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'10001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'01010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'01010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'00100'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'w'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'10101'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'10101'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'10101'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'10101'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'01010'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'x'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'10001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'01010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'00100'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'01010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'10001'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'y'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'10001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'01010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'00100'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'00100'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'00100'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'z'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'1111'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'0100'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'1111'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'.'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'110'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">','</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'010'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'!'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'010'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'('</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'100'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'100'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'100'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'010'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">')'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'010'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'010'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'?'</span><span style="color: #339933;">:</span>
                <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
                <span style="color: #3366CC;">'01110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'00001'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'00110'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'00000'</span><span style="color: #339933;">,</span>
                <span style="color: #3366CC;">'00100'</span>
                <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>arrLetterCode<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> arrLetterCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
            <span style="color: #3366CC;">'1111'</span><span style="color: #339933;">,</span>
            <span style="color: #3366CC;">'1111'</span><span style="color: #339933;">,</span>
            <span style="color: #3366CC;">'1111'</span><span style="color: #339933;">,</span>
            <span style="color: #3366CC;">'1111'</span><span style="color: #339933;">,</span>
            <span style="color: #3366CC;">'1111'</span>
            <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>						
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">return</span> arrLetterCode<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// ACTIVATE</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#doit'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>jsTexty.<span style="color: #660066;">Make</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#letterBox'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Ffun%2Ftext-to-pixel-font%2F&amp;title=Text%20to%20Pixel%20Font%21&amp;bodytext=So%2C%20this%20is%20a%20silly%20little%20proof%20of%20concept%20I%20came%20up%20with%20to%20kill%2020%20minutes%20in%20between%20projects.%20Takes%20regular%20text%20and%20turns%20it%20into%201px%20sized%20divs.%20That%27s%20right%2C%20the%20div%27s%20actually%20form%20the%20pixels%20of%20each%20letter%21%20%3AD%20Awesome%2C%20right%21%3F%20Check%20it%20out%21" title="Digg"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.michaelhartmayer.com%2Ffun%2Ftext-to-pixel-font%2F" title="Sphinn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Ffun%2Ftext-to-pixel-font%2F&amp;title=Text%20to%20Pixel%20Font%21&amp;notes=So%2C%20this%20is%20a%20silly%20little%20proof%20of%20concept%20I%20came%20up%20with%20to%20kill%2020%20minutes%20in%20between%20projects.%20Takes%20regular%20text%20and%20turns%20it%20into%201px%20sized%20divs.%20That%27s%20right%2C%20the%20div%27s%20actually%20form%20the%20pixels%20of%20each%20letter%21%20%3AD%20Awesome%2C%20right%21%3F%20Check%20it%20out%21" title="del.icio.us"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Ffun%2Ftext-to-pixel-font%2F&amp;t=Text%20to%20Pixel%20Font%21" title="Facebook"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.michaelhartmayer.com%2Ffun%2Ftext-to-pixel-font%2F&amp;title=Text%20to%20Pixel%20Font%21" title="Mixx"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.michaelhartmayer.com%2Ffun%2Ftext-to-pixel-font%2F&amp;title=Text%20to%20Pixel%20Font%21&amp;annotation=So%2C%20this%20is%20a%20silly%20little%20proof%20of%20concept%20I%20came%20up%20with%20to%20kill%2020%20minutes%20in%20between%20projects.%20Takes%20regular%20text%20and%20turns%20it%20into%201px%20sized%20divs.%20That%27s%20right%2C%20the%20div%27s%20actually%20form%20the%20pixels%20of%20each%20letter%21%20%3AD%20Awesome%2C%20right%21%3F%20Check%20it%20out%21" title="Google Bookmarks"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Ffun%2Ftext-to-pixel-font%2F&amp;title=Text%20to%20Pixel%20Font%21&amp;source=Michael+Hartmayer+Portfolio+of+an+Idea+Crafter&amp;summary=So%2C%20this%20is%20a%20silly%20little%20proof%20of%20concept%20I%20came%20up%20with%20to%20kill%2020%20minutes%20in%20between%20projects.%20Takes%20regular%20text%20and%20turns%20it%20into%201px%20sized%20divs.%20That%27s%20right%2C%20the%20div%27s%20actually%20form%20the%20pixels%20of%20each%20letter%21%20%3AD%20Awesome%2C%20right%21%3F%20Check%20it%20out%21" title="LinkedIn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Ffun%2Ftext-to-pixel-font%2F&amp;title=Text%20to%20Pixel%20Font%21" title="Live"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Ffun%2Ftext-to-pixel-font%2F&amp;t=Text%20to%20Pixel%20Font%21" title="MySpace"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Ffun%2Ftext-to-pixel-font%2F&amp;title=Text%20to%20Pixel%20Font%21" title="Reddit"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Ffun%2Ftext-to-pixel-font%2F&amp;title=Text%20to%20Pixel%20Font%21" title="StumbleUpon"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelhartmayer.com/fun/text-to-pixel-font/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loading JavaScript Better :)</title>
		<link>http://www.michaelhartmayer.com/javascript/loading-javascript-better/</link>
		<comments>http://www.michaelhartmayer.com/javascript/loading-javascript-better/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 04:04:47 +0000</pubDate>
		<dc:creator>Michael Hartmayer</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[js javascript optimization]]></category>

		<guid isPermaLink="false">http://www.michaelhartmayer.com/?p=498</guid>
		<description><![CDATA[After watching some very stimulating google tech talks on YouTube, I walked away with some new insight on how browsers load content. The following is a technique I picked up that allows for all included javascripts to load in parallel (instead of sequentially), and to prioritize the loading of your visible page content first. The [...]]]></description>
			<content:encoded><![CDATA[<p>After watching some very stimulating google tech talks on YouTube, I walked away with some new insight on how browsers load content. The following is a technique I picked up that allows for all included javascripts to load in parallel (instead of sequentially), and to prioritize the loading of your visible page content first.</p>
<p>The following code is placed before the closing body tag (and not in the head, as is traditionally done).</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span> 
	<span style="color: #003366; font-weight: bold;">var</span> DocumentHead <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'head'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">function</span> jsOptimizedLoader<span style="color: #009900;">&#40;</span>src<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> Script <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			Script.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> src<span style="color: #339933;">;</span>
			Script.<span style="color: #660066;">type</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'text/javascript'</span><span style="color: #339933;">;</span>
			DocumentHead.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>Script<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	jsOptimizedLoader<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'js/app/foo.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	jsOptimizedLoader<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'js/app/bar.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	jsOptimizedLoader<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'js/app/boo.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	jsOptimizedLoader<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'js/app/far.js'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Once your DOM has finished loading, all the scripts tags are added to the head via javascript. Allowing your page to display PRIOR to spending the time loading all of those scripts will win you usability points and ease of access points with your audience.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Floading-javascript-better%2F&amp;title=Loading%20JavaScript%20Better%20%3A%29&amp;bodytext=After%20watching%20some%20very%20stimulating%20google%20tech%20talks%20on%20YouTube%2C%20I%20walked%20away%20with%20some%20new%20insight%20on%20how%20browsers%20load%20content.%20The%20following%20is%20a%20technique%20I%20picked%20up%20that%20allows%20for%20all%20included%20javascripts%20to%20load%20in%20parallel%20%28instead%20of%20seq" title="Digg"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Floading-javascript-better%2F" title="Sphinn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Floading-javascript-better%2F&amp;title=Loading%20JavaScript%20Better%20%3A%29&amp;notes=After%20watching%20some%20very%20stimulating%20google%20tech%20talks%20on%20YouTube%2C%20I%20walked%20away%20with%20some%20new%20insight%20on%20how%20browsers%20load%20content.%20The%20following%20is%20a%20technique%20I%20picked%20up%20that%20allows%20for%20all%20included%20javascripts%20to%20load%20in%20parallel%20%28instead%20of%20seq" title="del.icio.us"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Floading-javascript-better%2F&amp;t=Loading%20JavaScript%20Better%20%3A%29" title="Facebook"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Floading-javascript-better%2F&amp;title=Loading%20JavaScript%20Better%20%3A%29" title="Mixx"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Floading-javascript-better%2F&amp;title=Loading%20JavaScript%20Better%20%3A%29&amp;annotation=After%20watching%20some%20very%20stimulating%20google%20tech%20talks%20on%20YouTube%2C%20I%20walked%20away%20with%20some%20new%20insight%20on%20how%20browsers%20load%20content.%20The%20following%20is%20a%20technique%20I%20picked%20up%20that%20allows%20for%20all%20included%20javascripts%20to%20load%20in%20parallel%20%28instead%20of%20seq" title="Google Bookmarks"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Floading-javascript-better%2F&amp;title=Loading%20JavaScript%20Better%20%3A%29&amp;source=Michael+Hartmayer+Portfolio+of+an+Idea+Crafter&amp;summary=After%20watching%20some%20very%20stimulating%20google%20tech%20talks%20on%20YouTube%2C%20I%20walked%20away%20with%20some%20new%20insight%20on%20how%20browsers%20load%20content.%20The%20following%20is%20a%20technique%20I%20picked%20up%20that%20allows%20for%20all%20included%20javascripts%20to%20load%20in%20parallel%20%28instead%20of%20seq" title="LinkedIn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Floading-javascript-better%2F&amp;title=Loading%20JavaScript%20Better%20%3A%29" title="Live"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Floading-javascript-better%2F&amp;t=Loading%20JavaScript%20Better%20%3A%29" title="MySpace"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Floading-javascript-better%2F&amp;title=Loading%20JavaScript%20Better%20%3A%29" title="Reddit"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Floading-javascript-better%2F&amp;title=Loading%20JavaScript%20Better%20%3A%29" title="StumbleUpon"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelhartmayer.com/javascript/loading-javascript-better/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE6 / IE7 jQuery Fix: Anchor Image Clickable Area</title>
		<link>http://www.michaelhartmayer.com/web-design/ie6-ie7-jquery-fix-anchor-image-clickable-area/</link>
		<comments>http://www.michaelhartmayer.com/web-design/ie6-ie7-jquery-fix-anchor-image-clickable-area/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 18:45:31 +0000</pubDate>
		<dc:creator>Michael Hartmayer</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[ie7]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.michaelhartmayer.com/?p=396</guid>
		<description><![CDATA[IE6 and IE7 both experience a problem in which images inside of block elements inside of anchors lose their click ability. Here&#8217;s an example: &#60;a href=&#34;rss-icon.png&#34;&#62; &#60;span style=&#34;display:block; width:100px; height:100px;&#34;&#62; &#60;img src=&#34;someImage.png&#34; /&#62; &#60;/span&#62; &#60;/a&#62; Every area of the link remains click-able except for the surface consumed by someImage.png. (Note, this problem will not show [...]]]></description>
			<content:encoded><![CDATA[<p>IE6 and IE7 both experience a problem in which images inside of block elements inside of anchors lose their click ability. Here&#8217;s an example:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;rss-icon.png&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;span</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;display:block; width:100px; height:100px;&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;someImage.png&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/span<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Every area of the link remains click-able except for the surface consumed by someImage.png. (Note, this problem will not show in IE8, or FF)</p>
<p>Here&#8217;s a very small jQuery plugin I wrote to fix this particular issue.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$.<span style="color: #660066;">fn</span>.<span style="color: #660066;">fixClick</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>
				.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>cursor<span style="color: #339933;">:</span><span style="color: #3366CC;">'pointer'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
				.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					window.<span style="color: #660066;">location</span>.<span style="color: #660066;">href</span> <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
				<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Simply select your target element(s) and use this plugin to make the entire anchor click-able again. Here&#8217;s an example:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fixClick</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fweb-design%2Fie6-ie7-jquery-fix-anchor-image-clickable-area%2F&amp;title=IE6%20%2F%20IE7%20jQuery%20Fix%3A%20Anchor%20Image%20Clickable%20Area&amp;bodytext=IE6%20and%20IE7%20both%20experience%20a%20problem%20in%20which%20images%20inside%20of%20block%20elements%20inside%20of%20anchors%20lose%20their%20click%20ability.%20Here%27s%20an%20example%3A%0D%0A%0D%0A%0D%0A%0D%0A%09%0D%0A%09%09%0D%0A%09%0D%0A%0D%0A%0D%0A%0D%0AEvery%20area%20of%20the%20link%20remains%20click-able%20except%20for%20the%20surface%20consumed%20by%20someImag" title="Digg"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.michaelhartmayer.com%2Fweb-design%2Fie6-ie7-jquery-fix-anchor-image-clickable-area%2F" title="Sphinn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fweb-design%2Fie6-ie7-jquery-fix-anchor-image-clickable-area%2F&amp;title=IE6%20%2F%20IE7%20jQuery%20Fix%3A%20Anchor%20Image%20Clickable%20Area&amp;notes=IE6%20and%20IE7%20both%20experience%20a%20problem%20in%20which%20images%20inside%20of%20block%20elements%20inside%20of%20anchors%20lose%20their%20click%20ability.%20Here%27s%20an%20example%3A%0D%0A%0D%0A%0D%0A%0D%0A%09%0D%0A%09%09%0D%0A%09%0D%0A%0D%0A%0D%0A%0D%0AEvery%20area%20of%20the%20link%20remains%20click-able%20except%20for%20the%20surface%20consumed%20by%20someImag" title="del.icio.us"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fweb-design%2Fie6-ie7-jquery-fix-anchor-image-clickable-area%2F&amp;t=IE6%20%2F%20IE7%20jQuery%20Fix%3A%20Anchor%20Image%20Clickable%20Area" title="Facebook"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fweb-design%2Fie6-ie7-jquery-fix-anchor-image-clickable-area%2F&amp;title=IE6%20%2F%20IE7%20jQuery%20Fix%3A%20Anchor%20Image%20Clickable%20Area" title="Mixx"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.michaelhartmayer.com%2Fweb-design%2Fie6-ie7-jquery-fix-anchor-image-clickable-area%2F&amp;title=IE6%20%2F%20IE7%20jQuery%20Fix%3A%20Anchor%20Image%20Clickable%20Area&amp;annotation=IE6%20and%20IE7%20both%20experience%20a%20problem%20in%20which%20images%20inside%20of%20block%20elements%20inside%20of%20anchors%20lose%20their%20click%20ability.%20Here%27s%20an%20example%3A%0D%0A%0D%0A%0D%0A%0D%0A%09%0D%0A%09%09%0D%0A%09%0D%0A%0D%0A%0D%0A%0D%0AEvery%20area%20of%20the%20link%20remains%20click-able%20except%20for%20the%20surface%20consumed%20by%20someImag" title="Google Bookmarks"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fweb-design%2Fie6-ie7-jquery-fix-anchor-image-clickable-area%2F&amp;title=IE6%20%2F%20IE7%20jQuery%20Fix%3A%20Anchor%20Image%20Clickable%20Area&amp;source=Michael+Hartmayer+Portfolio+of+an+Idea+Crafter&amp;summary=IE6%20and%20IE7%20both%20experience%20a%20problem%20in%20which%20images%20inside%20of%20block%20elements%20inside%20of%20anchors%20lose%20their%20click%20ability.%20Here%27s%20an%20example%3A%0D%0A%0D%0A%0D%0A%0D%0A%09%0D%0A%09%09%0D%0A%09%0D%0A%0D%0A%0D%0A%0D%0AEvery%20area%20of%20the%20link%20remains%20click-able%20except%20for%20the%20surface%20consumed%20by%20someImag" title="LinkedIn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fweb-design%2Fie6-ie7-jquery-fix-anchor-image-clickable-area%2F&amp;title=IE6%20%2F%20IE7%20jQuery%20Fix%3A%20Anchor%20Image%20Clickable%20Area" title="Live"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fweb-design%2Fie6-ie7-jquery-fix-anchor-image-clickable-area%2F&amp;t=IE6%20%2F%20IE7%20jQuery%20Fix%3A%20Anchor%20Image%20Clickable%20Area" title="MySpace"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fweb-design%2Fie6-ie7-jquery-fix-anchor-image-clickable-area%2F&amp;title=IE6%20%2F%20IE7%20jQuery%20Fix%3A%20Anchor%20Image%20Clickable%20Area" title="Reddit"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fweb-design%2Fie6-ie7-jquery-fix-anchor-image-clickable-area%2F&amp;title=IE6%20%2F%20IE7%20jQuery%20Fix%3A%20Anchor%20Image%20Clickable%20Area" title="StumbleUpon"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelhartmayer.com/web-design/ie6-ie7-jquery-fix-anchor-image-clickable-area/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Alternating Styles in jQuery (Plug-In)</title>
		<link>http://www.michaelhartmayer.com/javascript/alternating-styles-jquery-plugin/</link>
		<comments>http://www.michaelhartmayer.com/javascript/alternating-styles-jquery-plugin/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 18:40:02 +0000</pubDate>
		<dc:creator>Michael Hartmayer</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.michaelhartmayer.com/?p=345</guid>
		<description><![CDATA[This is a little script that I wrote, that lets you easily alternate the style of repeating class elements, or w/e elements you want to select. This is particularly useful for lists, and the like. function&#40;$&#41;&#123; $.fn.styleAlternation = function&#40;aClass, bClass&#41; &#123; var i = 0; return this.each&#40;function&#40;&#41; &#123; if &#40;++i % 2 != 0 &#38;&#38; [...]]]></description>
			<content:encoded><![CDATA[<p>This is a little script that I wrote, that lets you easily alternate the style of repeating class elements, or w/e elements you want to select. This is particularly useful for lists, and the like.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
$.<span style="color: #660066;">fn</span>.<span style="color: #660066;">styleAlternation</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>aClass<span style="color: #339933;">,</span> bClass<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">++</span>i <span style="color: #339933;">%</span> <span style="color: #CC0000;">2</span> <span style="color: #339933;">!=</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">&amp;&amp;</span> aClass<span style="color: #339933;">!=</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span>aClass<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>bClass<span style="color: #339933;">!=</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span>bClass<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The usage is very simple. Here&#8217;s the JavaScript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#awesomeTable tr&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">styleAlternation</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;cssClass1&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;cssClass2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>From there, all you need to do is create your CSS. Example:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.cssClass1</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#444</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.cssClass2</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Here&#8217;s a screenshot:<br />
<a href="http://www.michaelhartmayer.com/wp-content/uploads/2009/07/tableSample.JPG" rel="lightbox"><img src="http://www.michaelhartmayer.com/wp-content/uploads/2009/07/tableSample.JPG" alt="Alternation Demo" title="Alternation Demo" width="301" height="263" class="alignnone size-full wp-image-353" /></a></p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Falternating-styles-jquery-plugin%2F&amp;title=Alternating%20Styles%20in%20jQuery%20%28Plug-In%29&amp;bodytext=This%20is%20a%20little%20script%20that%20I%20wrote%2C%20that%20lets%20you%20easily%20alternate%20the%20style%20of%20repeating%20class%20elements%2C%20or%20w%2Fe%20elements%20you%20want%20to%20select.%20This%20is%20particularly%20useful%20for%20lists%2C%20and%20the%20like.%0D%0A%0D%0A%0D%0Afunction%28%24%29%7B%0D%0A%24.fn.styleAlternation%20%3D%20function%28a" title="Digg"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Falternating-styles-jquery-plugin%2F" title="Sphinn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Falternating-styles-jquery-plugin%2F&amp;title=Alternating%20Styles%20in%20jQuery%20%28Plug-In%29&amp;notes=This%20is%20a%20little%20script%20that%20I%20wrote%2C%20that%20lets%20you%20easily%20alternate%20the%20style%20of%20repeating%20class%20elements%2C%20or%20w%2Fe%20elements%20you%20want%20to%20select.%20This%20is%20particularly%20useful%20for%20lists%2C%20and%20the%20like.%0D%0A%0D%0A%0D%0Afunction%28%24%29%7B%0D%0A%24.fn.styleAlternation%20%3D%20function%28a" title="del.icio.us"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Falternating-styles-jquery-plugin%2F&amp;t=Alternating%20Styles%20in%20jQuery%20%28Plug-In%29" title="Facebook"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Falternating-styles-jquery-plugin%2F&amp;title=Alternating%20Styles%20in%20jQuery%20%28Plug-In%29" title="Mixx"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Falternating-styles-jquery-plugin%2F&amp;title=Alternating%20Styles%20in%20jQuery%20%28Plug-In%29&amp;annotation=This%20is%20a%20little%20script%20that%20I%20wrote%2C%20that%20lets%20you%20easily%20alternate%20the%20style%20of%20repeating%20class%20elements%2C%20or%20w%2Fe%20elements%20you%20want%20to%20select.%20This%20is%20particularly%20useful%20for%20lists%2C%20and%20the%20like.%0D%0A%0D%0A%0D%0Afunction%28%24%29%7B%0D%0A%24.fn.styleAlternation%20%3D%20function%28a" title="Google Bookmarks"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Falternating-styles-jquery-plugin%2F&amp;title=Alternating%20Styles%20in%20jQuery%20%28Plug-In%29&amp;source=Michael+Hartmayer+Portfolio+of+an+Idea+Crafter&amp;summary=This%20is%20a%20little%20script%20that%20I%20wrote%2C%20that%20lets%20you%20easily%20alternate%20the%20style%20of%20repeating%20class%20elements%2C%20or%20w%2Fe%20elements%20you%20want%20to%20select.%20This%20is%20particularly%20useful%20for%20lists%2C%20and%20the%20like.%0D%0A%0D%0A%0D%0Afunction%28%24%29%7B%0D%0A%24.fn.styleAlternation%20%3D%20function%28a" title="LinkedIn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Falternating-styles-jquery-plugin%2F&amp;title=Alternating%20Styles%20in%20jQuery%20%28Plug-In%29" title="Live"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Falternating-styles-jquery-plugin%2F&amp;t=Alternating%20Styles%20in%20jQuery%20%28Plug-In%29" title="MySpace"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Falternating-styles-jquery-plugin%2F&amp;title=Alternating%20Styles%20in%20jQuery%20%28Plug-In%29" title="Reddit"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Falternating-styles-jquery-plugin%2F&amp;title=Alternating%20Styles%20in%20jQuery%20%28Plug-In%29" title="StumbleUpon"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelhartmayer.com/javascript/alternating-styles-jquery-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX Calendar Loader Using jQuery</title>
		<link>http://www.michaelhartmayer.com/javascript/ajax-calendar-loader-jquery/</link>
		<comments>http://www.michaelhartmayer.com/javascript/ajax-calendar-loader-jquery/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 20:04:15 +0000</pubDate>
		<dc:creator>Michael Hartmayer</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.michaelhartmayer.com/?p=335</guid>
		<description><![CDATA[My good pal Austin needed help turning his static calendar into one that could change the month, using AJAX. The calendar itself was written in PHP. Here is the quick and easy solution I came up with for him, using jQuery: $&#40;document&#41;.ready&#40;function&#40;&#41; &#123; &#160; // Create Date Object var jsDateObject = new Date&#40;&#41;; &#160; // [...]]]></description>
			<content:encoded><![CDATA[<p>My good pal Austin needed help turning his static calendar into one that could change the month, using AJAX. The calendar itself was written in PHP. Here is the quick and easy solution I came up with for him, using jQuery:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #006600; font-style: italic;">// Create Date Object</span>
   <span style="color: #003366; font-weight: bold;">var</span> jsDateObject <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #006600; font-style: italic;">// Create Calendar Object ( Holds all your variables, etc )</span>
   <span style="color: #003366; font-weight: bold;">var</span> jsCalendar <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
       jsCalendar.<span style="color: #660066;">currentMonth</span> <span style="color: #339933;">=</span> jsDateObject.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #006600; font-style: italic;">// Controls the NEXT button</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#jsCalendarNext&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">// Update Active Month</span>
      jsCalendar.<span style="color: #660066;">currentMonth</span><span style="color: #339933;">++;</span>
         <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>jsCalendar.<span style="color: #660066;">currentMonth</span><span style="color: #339933;">&gt;</span><span style="color: #CC0000;">12</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> jsCalendar.<span style="color: #660066;">currentMonth</span><span style="color: #339933;">=</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
      <span style="color: #006600; font-style: italic;">// Get New Calendar</span>
      ajaxUpdateCalendar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #006600; font-style: italic;">// Controls the PREV button</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#jsCalendarPrev&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">// Update Active Month</span>
      jsCalendar.<span style="color: #660066;">currentMonth</span><span style="color: #339933;">--;</span>
         <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>jsCalendar.<span style="color: #660066;">currentMonth</span><span style="color: #339933;">&lt;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> jsCalendar.<span style="color: #660066;">currentMonth</span><span style="color: #339933;">=</span><span style="color: #CC0000;">12</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
      <span style="color: #006600; font-style: italic;">// Get New Calendar</span>
      ajaxUpdateCalendar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #006600; font-style: italic;">// Use AJAX to update the Calendar</span>
   <span style="color: #003366; font-weight: bold;">function</span> ajaxUpdateCalendar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      $.<span style="color: #660066;">post</span><span style="color: #009900;">&#40;</span>
         <span style="color: #3366CC;">&quot;phpCalendarLoader.php&quot;</span><span style="color: #339933;">,</span>
         <span style="color: #009900;">&#123;</span> calendarMonth<span style="color: #339933;">:</span> jsCalendar.<span style="color: #660066;">currentMonth</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
         <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#jsCalendarContainer&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
         <span style="color: #3366CC;">&quot;html&quot;</span>
      <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>From here, all Austin had to do was set his <em>$month</em> variable to <em>$_POST['calendarMonth'];</em>.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fajax-calendar-loader-jquery%2F&amp;title=AJAX%20Calendar%20Loader%20Using%20jQuery&amp;bodytext=My%20good%20pal%20Austin%20needed%20help%20turning%20his%20static%20calendar%20into%20one%20that%20could%20change%20the%20month%2C%20using%20AJAX.%20The%20calendar%20itself%20was%20written%20in%20PHP.%20Here%20is%20the%20quick%20and%20easy%20solution%20I%20came%20up%20with%20for%20him%2C%20using%20jQuery%3A%0D%0A%0D%0A%24%28document%29.ready%28functi" title="Digg"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fajax-calendar-loader-jquery%2F" title="Sphinn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fajax-calendar-loader-jquery%2F&amp;title=AJAX%20Calendar%20Loader%20Using%20jQuery&amp;notes=My%20good%20pal%20Austin%20needed%20help%20turning%20his%20static%20calendar%20into%20one%20that%20could%20change%20the%20month%2C%20using%20AJAX.%20The%20calendar%20itself%20was%20written%20in%20PHP.%20Here%20is%20the%20quick%20and%20easy%20solution%20I%20came%20up%20with%20for%20him%2C%20using%20jQuery%3A%0D%0A%0D%0A%24%28document%29.ready%28functi" title="del.icio.us"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fajax-calendar-loader-jquery%2F&amp;t=AJAX%20Calendar%20Loader%20Using%20jQuery" title="Facebook"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fajax-calendar-loader-jquery%2F&amp;title=AJAX%20Calendar%20Loader%20Using%20jQuery" title="Mixx"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fajax-calendar-loader-jquery%2F&amp;title=AJAX%20Calendar%20Loader%20Using%20jQuery&amp;annotation=My%20good%20pal%20Austin%20needed%20help%20turning%20his%20static%20calendar%20into%20one%20that%20could%20change%20the%20month%2C%20using%20AJAX.%20The%20calendar%20itself%20was%20written%20in%20PHP.%20Here%20is%20the%20quick%20and%20easy%20solution%20I%20came%20up%20with%20for%20him%2C%20using%20jQuery%3A%0D%0A%0D%0A%24%28document%29.ready%28functi" title="Google Bookmarks"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fajax-calendar-loader-jquery%2F&amp;title=AJAX%20Calendar%20Loader%20Using%20jQuery&amp;source=Michael+Hartmayer+Portfolio+of+an+Idea+Crafter&amp;summary=My%20good%20pal%20Austin%20needed%20help%20turning%20his%20static%20calendar%20into%20one%20that%20could%20change%20the%20month%2C%20using%20AJAX.%20The%20calendar%20itself%20was%20written%20in%20PHP.%20Here%20is%20the%20quick%20and%20easy%20solution%20I%20came%20up%20with%20for%20him%2C%20using%20jQuery%3A%0D%0A%0D%0A%24%28document%29.ready%28functi" title="LinkedIn"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fajax-calendar-loader-jquery%2F&amp;title=AJAX%20Calendar%20Loader%20Using%20jQuery" title="Live"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fajax-calendar-loader-jquery%2F&amp;t=AJAX%20Calendar%20Loader%20Using%20jQuery" title="MySpace"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fajax-calendar-loader-jquery%2F&amp;title=AJAX%20Calendar%20Loader%20Using%20jQuery" title="Reddit"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.michaelhartmayer.com%2Fjavascript%2Fajax-calendar-loader-jquery%2F&amp;title=AJAX%20Calendar%20Loader%20Using%20jQuery" title="StumbleUpon"><img src="http://www.michaelhartmayer.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelhartmayer.com/javascript/ajax-calendar-loader-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

