<?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>Eric Wendelin's Blog &#187; Javascript</title>
	<atom:link href="http://eriwen.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://eriwen.com</link>
	<description>Programming productively with open-source tools</description>
	<lastBuildDate>Tue, 13 Jul 2010 13:14:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Javascript Stacktrace update</title>
		<link>http://eriwen.com/javascript/stacktrace-update/</link>
		<comments>http://eriwen.com/javascript/stacktrace-update/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 11:00:10 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eriwen.com/?p=1050</guid>
		<description><![CDATA[I started a <a href="http://eriwen.com/javascript/js-stack-trace/" title="A Javascript stacktrace in any browser">Javascript Stacktrace project</a> back in August 2008. The idea was to give additional debugging power to browsers where you don't have good tools to work with. I'd like to give you an update on where the project is today.

Lately, I've been working on updating my old script. Since it was written, we've seen lots of major browser releases and the introduction of the V8 Javascript engine used by <a href="http://www.google.com/chrome">Google Chrome</a>.

<h2>Updated browser compatibility</h2>
Browsers that are fully-supported and well-tested:
<ol>
<li>Firefox (and Iceweasel) 0.9+</li>
<li>Safari 3+</li>
<li>IE 5.5+</li>
<li>Konqueror 3.5+</li>
<li>K-Meleon 1.5.3+</li>
<li>Epiphany 2.28.0+</li>
</ol>

Browsers that are supported in almost all cases but not as well-tested:
<ol>
<li>Chrome 1+ - One bug (feature?) that may be in Chrome reporting functions as anonymous when they aren't. HOWEVER, Chrome's stack gives us line numbers AND column numbers, so we can see exactly where our problem is - even in minified Javascript! Sweet!</li>
<li>Opera 9+ - Opera is dead to me now. Opera 10+ has removed the error.stack info we needed and introduced error.stacktrace, but it seems very unstable.</li>
</ol>

More info about compatibility can be shown with the <a href="http://browsershots.org/http://eriwen.com/js/javascript-stacktrace/test-stacktrace.html" title="BrowserShots site testing">BrowserShots of the test suite</a>. 



Related posts:<ol><li><a href='http://eriwen.com/javascript/js-stack-trace/' rel='bookmark' title='Permanent Link: A Javascript stacktrace in any browser'>A Javascript stacktrace in any browser</a></li>
<li><a href='http://eriwen.com/python/update-feedburner-count/' rel='bookmark' title='Permanent Link: Using Python to update your FeedBurner stats'>Using Python to update your FeedBurner stats</a></li>
<li><a href='http://eriwen.com/javascript/measure-ems-for-layout/' rel='bookmark' title='Permanent Link: Javascript: Measure those &#8220;em&#8221;s for your layout'>Javascript: Measure those &#8220;em&#8221;s for your layout</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I started a <a href="http://eriwen.com/javascript/js-stack-trace/" title="A Javascript stacktrace in any browser">Javascript Stacktrace project</a> back in August 2008. The idea was to give additional debugging power to browsers where you don&#8217;t have good tools to work with. I&#8217;d like to give you an update on where the project is today.</p>
<p>Lately, I&#8217;ve been working on updating my old script. Since it was written, we&#8217;ve seen lots of major browser releases and the introduction of the V8 Javascript engine used by <a href="http://www.google.com/chrome">Google Chrome</a>.</p>
<h2>Updated browser compatibility</h2>
<p>Browsers that are fully-supported and well-tested:</p>
<ol>
<li>Firefox (and Iceweasel) 0.9+</li>
<li>UPDATE: Chrome 1+ now perfectly supported</li>
<li>Safari 3+</li>
<li>IE 5.5+</li>
<li>Opera 9+</li>
<li>Konqueror 3.5+</li>
<li>K-Meleon 1.5.3+</li>
<li>Epiphany 2.28.0+</li>
</ol>
<p>Browsers that are supported in almost all cases but not as well-tested:</p>
<ol>
<li><span style="text-decoration: line-through;">Chrome 1+ &#8211; One bug (feature?) that may be in Chrome reporting functions as anonymous when they aren&#8217;t. HOWEVER, Chrome&#8217;s stack gives us line numbers AND column numbers, so we can see exactly where our problem is &#8211; even in minified Javascript! Sweet!</span> Chrome 1+ now fully supported.</li>
<li>Opera 7-8 &#8211; Opera is dead to me now. Opera 10+ has removed the error.stack info we needed and introduced error.stacktrace, but it seems very unstable. Argh.</li>
</ol>
<p>More info about compatibility can be shown with the <a href="http://browsershots.org/http://eriwen.com/js/javascript-stacktrace/test-stacktrace.html" title="BrowserShots site testing">BrowserShots of the test suite</a>. </p>
<h2>Now socially coded</h2>
<p>I&#8217;m not going to post the code here because the source and tests are now on the <a href="http://github.com/emwendelin/javascript-stacktrace">javascript-stacktrace project on GitHub</a>. You can download it <a href="http://github.com/emwendelin/javascript-stacktrace/downloads" title="Javascript Stacktrace downloads">here</a>.</p>
<p>Follow it, file bugs, and make comments there. If you have improvements to make, please fork the project and then contact me or do a &#8220;push request&#8221;. I&#8217;ll make sure you get credit ;)</p>
<p class="update">UPDATE: <a href="http://kinsey.no/blog" title="rantings in the dark">Øyvind Sean Kinsey</a> has added memoization (caching the implementation) for the mode and XHR bits as well as the ability to pass an <strong>existing Javascript Error</strong> and get a stacktrace.  We&#8217;re working on tests and you should see project updates soon. Thanks, Øyvind!</p>
<pre class="brush: jscript;">
var lastError;
try {
    // error producing code
} catch(e) {
   lastError = e;
   // do something else with error
}

// later...
printStackTrace({e: lastError}); //Returns stacktrace from lastError!
</pre>
<h2>Try it out!</h2>
<p>The code is in use on my blog. <a href="javascript:foo();">Click here</a> to give it a spin. </p>
<pre class="brush: jscript; light: true;">
function foo() {
    var blah;
    bar(&quot;blah&quot;);
}

function bar(blah) {
    var stuff;
    thing();
}

function thing() {
    if (true) { //your error condition here
        var st = printStackTrace();
        alert(st.join(&quot;\n\n&quot;));
    }
}

foo();
</pre>
<p>Random note: one cool suggestion I saw was to assign printStackTrace to window.onerror. Pretty brilliant if you ask me. </p>
<p>I want to thank the guys who contributed to the script: <strong><a href="http://lucassmith.name">Luke Smith</a>, Loic Dachary and Johan Euphrosine.</strong></p>
<p>I could use a bit of help getting the Chrome and Opera bugs worked out. I&#8217;m sure some of you guys who remember how to write software can help. Suggestions and whinings are welcome as long as they don&#8217;t get out of hand in the comments.</p>
<p><a href="http://github.com/emwendelin/Javascript-Stacktrace">Javascript Stacktrace on GitHub</a></p>


<p>Related posts:<ol><li><a href='http://eriwen.com/javascript/js-stack-trace/' rel='bookmark' title='Permanent Link: A Javascript stacktrace in any browser'>A Javascript stacktrace in any browser</a></li>
<li><a href='http://eriwen.com/python/update-feedburner-count/' rel='bookmark' title='Permanent Link: Using Python to update your FeedBurner stats'>Using Python to update your FeedBurner stats</a></li>
<li><a href='http://eriwen.com/javascript/measure-ems-for-layout/' rel='bookmark' title='Permanent Link: Javascript: Measure those &#8220;em&#8221;s for your layout'>Javascript: Measure those &#8220;em&#8221;s for your layout</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/javascript/stacktrace-update/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>A Javascript stacktrace in any browser</title>
		<link>http://eriwen.com/javascript/js-stack-trace/</link>
		<comments>http://eriwen.com/javascript/js-stack-trace/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 12:00:58 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eriwen.com/?p=71</guid>
		<description><![CDATA[<p class="update">UPDATE: You'll want to check out the <a href="http://eriwen.com/javascript/stacktrace-update/" title="Javascript Stacktrace update">updated post</a> with new code, tests, and compatibility.</p>

Chances are that if you've done any significant Javascript work, you've run into a situation where part of the debugging process could be much improved if you just had the function call stack.

I'm going to give you some ways of doing this with and without the popular <a href="http://getfirebug.com" title="UI debugging">Firebug</a> extension and have some examples of their uses.

<h2>Without Firebug and friends? Using IE?</h2>

Sometimes s**t only happens in other browsers. Here's how to create/log your own stack trace. Put this code in an accessible place in your Javascript file(s) and call the <em>printStackTrace()</em> function inside any function. 

I'm going to give you some ways of doing this with and without the popular <a href="http://getfirebug.com" title="UI debugging">Firebug</a> extension and have some examples of their uses.

<h2>Without Firebug and friends? Using IE?</h2>

Sometimes s**t only happens in other browsers. Here's how to create/log your own stack trace. Put this code in an accessible place in your Javascript file(s) and call the <em>printStackTrace()</em> function inside any function.


Related posts:<ol><li><a href='http://eriwen.com/javascript/stacktrace-update/' rel='bookmark' title='Permanent Link: Javascript Stacktrace update'>Javascript Stacktrace update</a></li>
<li><a href='http://eriwen.com/javascript/measure-ems-for-layout/' rel='bookmark' title='Permanent Link: Javascript: Measure those &#8220;em&#8221;s for your layout'>Javascript: Measure those &#8220;em&#8221;s for your layout</a></li>
<li><a href='http://eriwen.com/javascript/highlight-search-results-with-js/' rel='bookmark' title='Permanent Link: How to highlight search results with JavaScript and CSS'>How to highlight search results with JavaScript and CSS</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p class="update"><strong>UPDATE:</strong> You&#8217;ll want to check out the <a href="http://eriwen.com/javascript/stacktrace-update/" title="Javascript Stacktrace update">updated post</a> with new code, tests, and compatibility.</p>
<p>Chances are that if you&#8217;ve done any significant Javascript work, you&#8217;ve run into a situation where part of the debugging process could be much improved if you just had the function call stack.</p>
<p>I&#8217;m going to give you some ways of doing this with and without the popular <a href="http://getfirebug.com" title="UI debugging">Firebug</a> extension and have some examples of their uses.</p>
<h2>Without Firebug and friends? Using IE?</h2>
<p>Sometimes s**t only happens in other browsers. Here&#8217;s how to create/log your own stack trace. Put this code in an accessible place in your Javascript file(s) and call the <em>printStackTrace()</em> function inside any function. </p>
<pre class="brush: jscript; wrap-lines: false;">
function printStackTrace() {
  var callstack = [];
  var isCallstackPopulated = false;
  try {
    i.dont.exist+=0; //doesn't exist- that's the point
  } catch(e) {
    if (e.stack) { //Firefox
      var lines = e.stack.split('\n');
      for (var i=0, len=lines.length; i&lt;len; i++) {
        if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
          callstack.push(lines[i]);
        }
      }
      //Remove call to printStackTrace()
      callstack.shift();
      isCallstackPopulated = true;
    }
    else if (window.opera &amp;&amp; e.message) { //Opera
      var lines = e.message.split('\n');
      for (var i=0, len=lines.length; i&lt;len; i++) {
        if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
          var entry = lines[i];
          //Append next line also since it has the file info
          if (lines[i+1]) {
            entry += &amp;quot; at &amp;quot; + lines[i+1];
            i++;
          }
          callstack.push(entry);
        }
      }
      //Remove call to printStackTrace()
      callstack.shift();
      isCallstackPopulated = true;
    }
  }
  if (!isCallstackPopulated) { //IE and Safari
    var currentFunction = arguments.callee.caller;
    while (currentFunction) {
      var fn = currentFunction.toString();
      var fname = fn.substring(fn.indexOf(&amp;quot;function&amp;quot;) + 8, fn.indexOf('')) || 'anonymous';
      callstack.push(fname);
      currentFunction = currentFunction.caller;
    }
  }
  output(callstack);
}

function output(arr) {
  //Optput however you want
  alert(arr.join('\n\n'));
}
</pre>
<p class="update"><strong>UPDATE:</strong> A few others have taken and upgraded the script with a bunch of new features. His changes and mine are now <a href="http://github.com/emwendelin/javascript-stacktrace">on GitHub</a>. Contribute!</p>
<p>It&#8217;s ugly, but this works for the latest versions of IE, Firefox, Opera, and Safari. Firefox and Opera give you file names and line numbers when they can, but I couldn&#8217;t find a mechanism to get the same from IE and Opera. Hopefully the inline comments describe enough of what is going on. If not, ask :). </p>
<h2>Try it out</h2>
<p>Give it a shot by <a href="javascript:foo();">clicking here</a>. It will run the snippet below.</p>
<pre class="brush: jscript; light: true;">
function foo() {
    var blah;
    bar(&amp;quot;blah&amp;quot;);
}

function bar(blah) {
    var stuff;
    thing();
}

function thing() {
    if (true) { //your error condition here
        printStackTrace();
    }
}

foo();
</pre>
<h2>Obvious easy way: Firebug (and Drosera and Dragonfly)</h2>
<p>You can easily get a stack trace at any time by calling <code>console.trace()</code> in your Javascript or in the Firebug console.<br />
<blockquote>Not only will it tell you which functions are on the stack, but it will include the value of each argument that was passed to each function.</p></blockquote>
<p> This is obviously the best way to go if you are using <a href="http://getfirefox.com" title="Firefox web browser">Firefox</a>. </p>
<p>Furthermore, these tools allow you to dig deeper. Of course, we can&#8217;t count on them for ALL situations. </p>
<h2>Conclusion</h2>
<p>I hope you find this useful. If you have any suggestions/improvements I&#8217;d like to hear them! Also all kidding aside, I worked pretty hard on this function, so I&#8217;d really appreciate if you&#8217;d help me share this with more people. Thanks!</p>


<p>Related posts:<ol><li><a href='http://eriwen.com/javascript/stacktrace-update/' rel='bookmark' title='Permanent Link: Javascript Stacktrace update'>Javascript Stacktrace update</a></li>
<li><a href='http://eriwen.com/javascript/measure-ems-for-layout/' rel='bookmark' title='Permanent Link: Javascript: Measure those &#8220;em&#8221;s for your layout'>Javascript: Measure those &#8220;em&#8221;s for your layout</a></li>
<li><a href='http://eriwen.com/javascript/highlight-search-results-with-js/' rel='bookmark' title='Permanent Link: How to highlight search results with JavaScript and CSS'>How to highlight search results with JavaScript and CSS</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/javascript/js-stack-trace/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
		</item>
		<item>
		<title>Create a Color Palette Using CSS and MooTools 1.2</title>
		<link>http://eriwen.com/css/color-palette-with-css-and-moo/</link>
		<comments>http://eriwen.com/css/color-palette-with-css-and-moo/#comments</comments>
		<pubDate>Thu, 15 May 2008 07:00:54 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Guest]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eriwen.com/?p=50</guid>
		<description><![CDATA[<p class="update">This entry was authored by highly-respected blogger and friend <a href="http://davidwalsh.name" target="_blank">David Walsh</a>. <a href="http://eriwen.com/css/color-palette-with-css-and-moo/#bio-david">Learn more about David</a></p>
<p>As you can see from my site's <span style="text-decoration: line-through;">lack of</span> design (<a href="http://davidwalsh.name/" target="_blank">davidwalsh.name</a>), I'm about 90% programmer and 10% designer.  As someone that's not a designer, I'm really grateful for websites like <a href="http://www.colourlovers.com/" target="_blank">ColourLovers</a> -- websites that provide you palettes of colors that look good together.  Let's pretend for a moment that I do have a good design and I want others to know my palette.  MooTools 1.2 has made that a reality.</p>
<p><a href="http://davidwalsh.name/dw-content/color-palette.php" target="_blank"><img src="http://davidwalsh.name/dw-content/palette.jpg" alt="" /></a></p>


Related posts:<ol><li><a href='http://eriwen.com/javascript/text-size-prefs/' rel='bookmark' title='Permanent Link: Guest Post: Save Text Size Preference Using MooTools and PHP'>Guest Post: Save Text Size Preference Using MooTools and PHP</a></li>
<li><a href='http://eriwen.com/books/mootools-1-2-beginners-guide/' rel='bookmark' title='Permanent Link: Book Review: MooTools 1.2 Beginner&#8217;s Guide'>Book Review: MooTools 1.2 Beginner&#8217;s Guide</a></li>
<li><a href='http://eriwen.com/css/speech-bubble/' rel='bookmark' title='Permanent Link: A CSS-only speech bubble'>A CSS-only speech bubble</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p class="update">This entry was authored by highly-respected blogger and friend <a href="http://davidwalsh.name" target="_blank">David Walsh</a>. <a href="http://eriwen.com/css/color-palette-with-css-and-moo/#bio-david">Learn more about David</a></p>
<p>As you can see from my site&#8217;s <span style="text-decoration: line-through;">lack of</span> design (<a href="http://davidwalsh.name/" target="_blank">davidwalsh.name</a>), I&#8217;m about 90% programmer and 10% designer.  As someone that&#8217;s not a designer, I&#8217;m really grateful for websites like <a href="http://www.colourlovers.com/" target="_blank">ColourLovers</a> &#8212; websites that provide you palettes of colors that look good together.  Let&#8217;s pretend for a moment that I do have a good design and I want others to know my palette.  MooTools 1.2 has made that a reality.</p>
<p><a href="http://davidwalsh.name/dw-content/color-palette.php" target="_blank"><img src="http://davidwalsh.name/dw-content/palette.jpg" alt="" /></a></p>
<h2>Step 1: The XHTML</h2>
<pre class="brush: xml;">
&lt;input type=&quot;button&quot; id=&quot;get-colors&quot; value=&quot;Get Colors&quot; class=&quot;button&quot; /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;div id=&quot;colors-wrapper&quot;&gt;&lt;/div&gt;
</pre>
<p>I&#8217;ve created two elements to begin with:  a DIV that will serve as a wrapper for the color palette and a button that will trigger the color palette&#8217;s creation.</p>
<h2>Step 2: The CSS</h2>
<pre class="brush: css;">
.dcolor     { height:40px; }
.dtext      {  }
.dwrapper { width:100px; float:left; padding:10px; margin:0 20px 20px 0; border:1px solid #ccc; }
</pre>
<p>The above CSS simply formats the elements that are needed to create the palette.</p>
<h2>Step 3: The Moo 1.2 Javascript</h2>
<pre class="brush: jscript;">
//once the dom is ready
window.addEvent('domready', function() {

	//do it!
	$('get-colors').addEvent('click', function() {
		//starting the colors array
		var colors = [];
		var disallows = ['transparent'];

		//for every element
		$$('*').each(function(el) {
			//record colors!
			colors.include(el.getStyle('color'));
			colors.include(el.getStyle('background-color'));
			el.getStyle('border-color').split(' ').each(function(c) {
				colors.include(c);
			});
		});

		//sort the colors
		colors.sort();

		//empty wrapper
		$('colors-wrapper').empty();

		//for every color...
		colors.each(function(val,i) {

			//if it's good
			if(!disallows.contains(val))
			{
				//create wrapper div
				var wrapper = new Element('div', {
					'class':'dwrapper'
				});

				//create color div, inject
				var colorer = new Element('div', {
					'class':'dcolor',
					'style': 'background:' + val
				});
				colorer.inject(wrapper);

				//alert(val);

				//create text div, inject
				var texter = new Element('div', {
					'class':'dtext',
					'text':val
				});
				texter.inject(wrapper);

				//inject wrapper
				wrapper.inject($('colors-wrapper'));
			}
		});
	});
});
</pre>
<p>Once the DOM is ready, we start listening for a click on our &#8220;Get Colors&#8221; button.  When the button is clicked, we store every element&#8217;s background color, border color, and text color.  Once we have every color in our array, we sort the array and clear the wrapper DIV.  For every color we&#8217;ve found, we create a DIV that displays the color and it&#8217;s hex value.  That&#8217;s it!</p>
<p>The result?  A sweet javascript script giving you a color palette of the current page.  <a href="http://davidwalsh.name/dw-content/color-palette.php" target="_blank">Click here to build a color palette</a> of my example page!</p>
<p><em>Note: This script doesn&#8217;t accommodate images.</em></p>
<p><a name="bio-david" /></p>
<p class="bio"><img src="http://eriwen.com/images/david-walsh.gif" alt="David Walsh" style="float: left; margin: 0px 8px 4px 0px;" /><a href="http://davidwalsh.name" target="_blank">David Walsh</a> is a Senior Web Developer residing in Madison, WI. He spends most of his day getting a monitor tan coding PHP, CSS, MooTools, and XHTML. When not tinkering with the newest version of <a href="http://mootools.net" target="_blank">Moo</a>, David uses soccer, Rock Band, and movies to dull his coding pains.</p>


<p>Related posts:<ol><li><a href='http://eriwen.com/javascript/text-size-prefs/' rel='bookmark' title='Permanent Link: Guest Post: Save Text Size Preference Using MooTools and PHP'>Guest Post: Save Text Size Preference Using MooTools and PHP</a></li>
<li><a href='http://eriwen.com/books/mootools-1-2-beginners-guide/' rel='bookmark' title='Permanent Link: Book Review: MooTools 1.2 Beginner&#8217;s Guide'>Book Review: MooTools 1.2 Beginner&#8217;s Guide</a></li>
<li><a href='http://eriwen.com/css/speech-bubble/' rel='bookmark' title='Permanent Link: A CSS-only speech bubble'>A CSS-only speech bubble</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/css/color-palette-with-css-and-moo/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Guest Post: Save Text Size Preference Using MooTools and PHP</title>
		<link>http://eriwen.com/javascript/text-size-prefs/</link>
		<comments>http://eriwen.com/javascript/text-size-prefs/#comments</comments>
		<pubDate>Wed, 30 Apr 2008 13:40:19 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://eriwen.com/?p=47</guid>
		<description><![CDATA[<p>I have posted a <a href="http://davidwalsh.name/save-text-size-preference-mootools-12">major update</a> to my <a href="http://davidwalsh.name/change-text-size-onclick-with-javascript" target="_blank">original post</a> about Changing Text Size onClick with JavaScript at the <a href="http://davidwalsh.name" target="_blank">David Walsh Blog</a>.</p>
<p>It allows you to store your users' text-size preferences in a cookie so that they don't have to resize the text to their liking on every page. <a href="http://eriwen.com/examples/save-font-size-prefs-example.php" target="_blank">Check out the demo</a> (remember to refresh the page to test the cookie!) and then check out how to<a href="http://davidwalsh.name/save-text-size-preference-mootools-12" target="_blank">Save Text Size Preference using MooTools and PHP</a>!</p>


Related posts:<ol><li><a href='http://eriwen.com/javascript/change-text-size-onclick-with-javascript/' rel='bookmark' title='Permanent Link: Guest Post: change text size onclick with JavaScript'>Guest Post: change text size onclick with JavaScript</a></li>
<li><a href='http://eriwen.com/tools/guest-post-on-caching-and-htaccess/' rel='bookmark' title='Permanent Link: Guest post on caching and .htaccess'>Guest post on caching and .htaccess</a></li>
<li><a href='http://eriwen.com/books/mootools-1-2-beginners-guide/' rel='bookmark' title='Permanent Link: Book Review: MooTools 1.2 Beginner&#8217;s Guide'>Book Review: MooTools 1.2 Beginner&#8217;s Guide</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I have posted a <a href="http://davidwalsh.name/save-text-size-preference-mootools-12">major update</a> to my <a href="http://davidwalsh.name/change-text-size-onclick-with-javascript" target="_blank">original post</a> about Changing Text Size onClick with JavaScript at the <a href="http://davidwalsh.name" target="_blank">David Walsh Blog</a>.</p>
<p>It allows you to store your users&#8217; text-size preferences in a cookie so that they don&#8217;t have to resize the text to their liking on every page. <a href="http://eriwen.com/examples/save-font-size-prefs-example.php" target="_blank">Check out the demo</a> (remember to refresh the page to test the cookie!) and then check out how to <a href="http://davidwalsh.name/save-text-size-preference-mootools-12" target="_blank">Save Text Size Preference using MooTools and PHP</a>!</p>


<p>Related posts:<ol><li><a href='http://eriwen.com/javascript/change-text-size-onclick-with-javascript/' rel='bookmark' title='Permanent Link: Guest Post: change text size onclick with JavaScript'>Guest Post: change text size onclick with JavaScript</a></li>
<li><a href='http://eriwen.com/tools/guest-post-on-caching-and-htaccess/' rel='bookmark' title='Permanent Link: Guest post on caching and .htaccess'>Guest post on caching and .htaccess</a></li>
<li><a href='http://eriwen.com/books/mootools-1-2-beginners-guide/' rel='bookmark' title='Permanent Link: Book Review: MooTools 1.2 Beginner&#8217;s Guide'>Book Review: MooTools 1.2 Beginner&#8217;s Guide</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/javascript/text-size-prefs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript: Measure those &#8220;em&#8221;s for your layout</title>
		<link>http://eriwen.com/javascript/measure-ems-for-layout/</link>
		<comments>http://eriwen.com/javascript/measure-ems-for-layout/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 04:08:24 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eriwen.com/javascript/measure-ems-for-layout/</guid>
		<description><![CDATA[For many of us designing fluid layouts, which are generally based in "em"s (pronounced like the letter M) you end up not really knowing how many pixels an "em" is while you are deep in the <abbr title="Document Object Model">DOM</abbr> tree. This is especially confusing if you increase/decrease text size with your browser.

For this reason, I have created a simple Javascript function that you can use to poll any element on your test page and figure out what size an "em" is.


Related posts:<ol><li><a href='http://eriwen.com/firefox/editing-layout-in-firebug/' rel='bookmark' title='Permanent Link: Quick Tip: Editing layout in Firebug'>Quick Tip: Editing layout in Firebug</a></li>
<li><a href='http://eriwen.com/javascript/highlight-search-results-with-js/' rel='bookmark' title='Permanent Link: How to highlight search results with JavaScript and CSS'>How to highlight search results with JavaScript and CSS</a></li>
<li><a href='http://eriwen.com/css/use-the-table-layout-css-property-to-speed-up-table-rendering/' rel='bookmark' title='Permanent Link: Use the table-layout CSS property to speed up table rendering'>Use the table-layout CSS property to speed up table rendering</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>For many of us designing fluid layouts, which are generally based in &#8220;em&#8221;s (pronounced like the letter M) you end up not really knowing how many pixels an &#8220;em&#8221; is while you are deep in the <abbr title="Document Object Model">DOM</abbr> tree. This is especially confusing if you increase/decrease text size with your browser.</p>
<p>For this reason, I have created a simple Javascript function that you can use to poll any element on your test page and figure out what size an &#8220;em&#8221; is.</p>
<h2>The Javascript code:</h2>
<pre class="brush: jscript;">
function getEmSize(el) {
  // If you pass in an element ID then get a reference to the element
  if (typeof el == &quot;string&quot;) el = document.getElementById(el);

  if (el != null) {
    var tempDiv = document.createElement(&quot;DIV&quot;);
    tempDiv.style.height = 1 + &quot;em&quot;;
    // Make a readable bar with the em measurement
    tempDiv.style.background = &quot;#FF9&quot;;
    tempDiv.style.color = &quot;#000&quot;;
    tempDiv.style.paddingBottom = 4 + &quot;px&quot;; // This makes the DIV text readable
    // Just in case the content of &quot;el&quot; takes up it's container's height :)
    tempDiv.style.marginTop = -1 + &quot;em&quot;;

    el.appendChild(tempDiv);
    // Remember to take off the 4px we added earlier
    var emSize = (tempDiv.offsetHeight - 4) + &quot;px&quot;;
    tempDiv.innerHTML = emSize;
  }
}
</pre>
<h2>Explanation and Usage</h2>
<p>This function will create a yellow bar below content within the element you pass in with the pixel value equivalent to 1 &#8220;em&#8221;. You can change it to print the value to the console by replacing lines 8-18 with:</p>
<pre class="brush: jscript;">
    el.appendChild(tempDiv);
    console.log(tempDiv.offsetHeight + &quot;px&quot;);
    el.removeChild(tempDiv);
</pre>
<p>You can easily use this function by calling:</p>
<pre class="brush: jscript;">
    getEmSize(&quot;elementid&quot;);
    // OR
    getEmSize(elementReference);
</pre>
<p>from your navigation bar or <a href="http://getfirebug.com" target="_blank">Firebug</a> console or of course within a loop traversing your entire DOM tree (watch out for those text nodes though!).</p>
<h2>Caveats</h2>
<p>You could improve this by implementing some <abbr title="Cascading Style Sheets">CSS</abbr> positioning to always be a the lower-right etc. of these elements. You could also use a loop as I said earlier and print out a nice <abbr title="Document Object Model">DOM</abbr> tree with pixel values. You could also have the function update a global variable while printing to console to prevent using <em>document.createElement()</em> so often (it&#8217;s costly).</p>
<p>I know that there are some improvements to be made here so I wanna see some in the comments! What other ways do you keep track of your &#8220;em&#8221;s in a fluid layout?</p>


<p>Related posts:<ol><li><a href='http://eriwen.com/firefox/editing-layout-in-firebug/' rel='bookmark' title='Permanent Link: Quick Tip: Editing layout in Firebug'>Quick Tip: Editing layout in Firebug</a></li>
<li><a href='http://eriwen.com/javascript/highlight-search-results-with-js/' rel='bookmark' title='Permanent Link: How to highlight search results with JavaScript and CSS'>How to highlight search results with JavaScript and CSS</a></li>
<li><a href='http://eriwen.com/css/use-the-table-layout-css-property-to-speed-up-table-rendering/' rel='bookmark' title='Permanent Link: Use the table-layout CSS property to speed up table rendering'>Use the table-layout CSS property to speed up table rendering</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/javascript/measure-ems-for-layout/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Staples of the Bookshelf: ppk on JavaScript</title>
		<link>http://eriwen.com/javascript/ppk-on-javascript/</link>
		<comments>http://eriwen.com/javascript/ppk-on-javascript/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 05:13:11 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://eriwen.com/javascript/ppk-on-javascript/</guid>
		<description><![CDATA[Peter-Paul Koch explains how to create beautiful JavaScript and shows you how to combine it with proper HTML and CSS for the best web experience in <a href="http://www.quirksmode.org/book/">ppk on JavaScript</a>. Here is my review.
<h4>The structure of this book</h4>
<abbr title="Peter-Paul Koch">ppk</abbr> begins with a brief history of JavaScript and explains the "fat and thin" JavaScript cycle. I would agree with him on that <strong>we are in a fattening state right now</strong>, but I think the tides will turn soon (my guess is before 2010).

Then <abbr title="Peter-Paul Koch">ppk</abbr> gives a basic overview of accessibility (which he adds to later) before introducing us to the 8 real world scripts used as examples in this book:

<img src="/images/ppk.jpg" alt="ppk on JavaScript" style="margin: 3px 6px 3px 0px; float: left" />
<ul>
	<li>Textarea Maxlength</li>
	<li>Usable Forms</li>
	<li>Form Validation</li>
	<li>Dropdown Menu</li>
	<li>Edit Style Sheets</li>
	<li>Sandwich Picker</li>
	<li>XMLHTTP Speed Meter</li>
	<li>Site Survey</li>
</ul>
We then see chapters on browsers, how to prepare your markup for good JavaScript and a series of chapters that use his examples heavily giving light on several very diverse topics of JavaScript.


Related posts:<ol><li><a href='http://eriwen.com/javascript/stacktrace-update/' rel='bookmark' title='Permanent Link: Javascript Stacktrace update'>Javascript Stacktrace update</a></li>
<li><a href='http://eriwen.com/javascript/measure-ems-for-layout/' rel='bookmark' title='Permanent Link: Javascript: Measure those &#8220;em&#8221;s for your layout'>Javascript: Measure those &#8220;em&#8221;s for your layout</a></li>
<li><a href='http://eriwen.com/javascript/js-stack-trace/' rel='bookmark' title='Permanent Link: A Javascript stacktrace in any browser'>A Javascript stacktrace in any browser</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Peter-Paul Koch explains how to create beautiful JavaScript and shows you how to combine it with proper HTML and CSS for the best web experience in <a href="http://www.quirksmode.org/book/">ppk on JavaScript</a>. Here is my review.</p>
<h2>The structure of this book</h2>
<p><abbr title="Peter-Paul Koch">ppk</abbr> begins with a brief history of JavaScript and explains the &#8220;fat and thin&#8221; JavaScript cycle. I would agree with him on that <strong>we are in a fattening state right now</strong>, but I think the tides will turn soon (my guess is before 2010).</p>
<p>Then <abbr title="Peter-Paul Koch">ppk</abbr> gives a basic overview of accessibility (which he adds to later) before introducing us to the 8 real world scripts used as examples in this book:</p>
<p><img src="/images/ppk.jpg" alt="ppk on JavaScript" style="margin: 3px 6px 3px 0px; float: left" /></p>
<ul style="padding-left: 20px;">
<li>Textarea Maxlength</li>
<li>Usable Forms</li>
<li>Form Validation</li>
<li>Dropdown Menu</li>
<li>Edit Style Sheets</li>
<li>Sandwich Picker</li>
<li>XMLHTTP Speed Meter</li>
<li>Site Survey</li>
</ul>
<p>We then see chapters on browsers, how to prepare your markup for good JavaScript and a series of chapters that use his examples heavily giving light on several very diverse topics of JavaScript.</p>
<h2>Bits of ingenuity</h2>
<p>Here I am going to sum of a few particularly useful snippets of this book.</p>
<p>A section on object detection vs. browser detection explains that <strong>object detection is the better way to go in general</strong>. <abbr title="Peter-Paul Koch">ppk</abbr> makes a good case for object detection: <strong>browsers will change, and by using object detection we can determine if an action is executed by directly tying the action to its dependencies.</strong> A lot of good JavaScript coders believe in this but it cannot be stressed enough.</p>
<p>Koch also knows that we need other fundamentals of how to setup our <abbr title="HyperText Markup Language">HTML</abbr> and <abbr title="Cascading Style Sheets">CSS</abbr> for good JavaScript. He makes a very appropriate example for this is his Sandwich Picker script in <em>Chapter 4: Preparation</em> He summed up his advice well by saying:</p>
<blockquote><p>Obviousness is the key to creating HTML structures that will help your script instead of hinder it</p></blockquote>
<p>Since we want to separate content from behavior, we need to develop <strong>obvious</strong> element hooks to neatly tie our JavaScript to our <abbr title="HyperText Markup Language">HTML</abbr> and <abbr title="Cascading Style Sheets">CSS</abbr>. We learn that the <em>id</em> attribute is the best known and most popular element hook. Another great idea that <abbr title="Peter-Paul Koch">ppk</abbr> presents here, though, is using custom attributes, such as a <em>rel</em> attribute.</p>
<p>One last bit I&#8217;d like to mention here is that ppk&#8217;s createXMLHTTPObject() function in <em>Chapter 10: Data Retrieval</em> is really quite elegant and I think you might check it out <a href="http://www.quirksmode.org/js/xmlhttp.html" target="_blank">here</a>. Your homework is to make this function rewrite itself upon successful completion so that it doesn&#8217;t have to try different methods of creation after the first call. ;)</p>
<h2>Conclusion</h2>
<p>There are several reasons I highly recommend this book, and Koch&#8217;s site: <a href="http://quirksmode.org" target="_blank">quirksmode.org</a>.</p>
<p>First of all <abbr title="Peter-Paul Koch">ppk</abbr> gives us a really good foundation in <em>Chapter 5: Core</em>, <strong>one that I would recommend even experienced JavaScript-ers read.</strong> He also covers the <abbr title="Browser Object Model">BOM</abbr>, JavaScript Events, and <abbr title="Document Object Model">DOM</abbr> in great detail also keeping accessibility fresh in your head as you pick up JavaScript&#8217;s quirks and issues with different browsers. That said, I would say that the amount of history covered by the book may have been excessive but may be more helpful to other readers.</p>
<p><a href="http://www.quirksmode.org/book/">ppk on JavaScript</a> is a good reference book that I keep as one of only 10 books within arms reach at work (I obviously have others but I don&#8217;t feel the need to keep many so close by). I think that more than a few of you would also benefit from keeping this book handy as well as checking out <a href="http://quirksmode.org" target="_blank">quirksmode.org</a> for other bits.</p>


<p>Related posts:<ol><li><a href='http://eriwen.com/javascript/stacktrace-update/' rel='bookmark' title='Permanent Link: Javascript Stacktrace update'>Javascript Stacktrace update</a></li>
<li><a href='http://eriwen.com/javascript/measure-ems-for-layout/' rel='bookmark' title='Permanent Link: Javascript: Measure those &#8220;em&#8221;s for your layout'>Javascript: Measure those &#8220;em&#8221;s for your layout</a></li>
<li><a href='http://eriwen.com/javascript/js-stack-trace/' rel='bookmark' title='Permanent Link: A Javascript stacktrace in any browser'>A Javascript stacktrace in any browser</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/javascript/ppk-on-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to highlight search results with JavaScript and CSS</title>
		<link>http://eriwen.com/javascript/highlight-search-results-with-js/</link>
		<comments>http://eriwen.com/javascript/highlight-search-results-with-js/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 05:29:54 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://eriwen.com/javascript/highlight-search-results-with-js/</guid>
		<description><![CDATA[<img alt="Google highlight search text" src="images/highlight_search.jpg" style="padding: 0px 0px 4px 6px; float: right;" />You see it in Google search results and a lot of other sites that have good search functionality. When you perform a search, your words or phrases are highlighted in the search results making it easy for you to find the most relevant content.

Today I'm going to show you a simple way to add this to your website or blog so your users can find what they need in style. I think that this kind of thing should be implemented more often for how easy it is to implement.

Here we go!


Related posts:<ol><li><a href='http://eriwen.com/javascript/measure-ems-for-layout/' rel='bookmark' title='Permanent Link: Javascript: Measure those &#8220;em&#8221;s for your layout'>Javascript: Measure those &#8220;em&#8221;s for your layout</a></li>
<li><a href='http://eriwen.com/javascript/stacktrace-update/' rel='bookmark' title='Permanent Link: Javascript Stacktrace update'>Javascript Stacktrace update</a></li>
<li><a href='http://eriwen.com/javascript/change-text-size-onclick-with-javascript/' rel='bookmark' title='Permanent Link: Guest Post: change text size onclick with JavaScript'>Guest Post: change text size onclick with JavaScript</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p class="update">Welcome to Eric Wendelin&#8217;s blog! You&#8217;re guaranteed to more great Javascript tutorials easily if you <a href="http://eriwen.com/feed/">subscribe via RSS</a>.</p>
<p><img alt="Google highlight search text" src="images/highlight_search.jpg" style="margin: 0px 0px 4px 8px; float: right;" />You see it in Google search results and a lot of other sites that have good search functionality. When you perform a search, your words or phrases are highlighted in the search results making it easy for you to find the most relevant content.</p>
<p>Today I&#8217;m going to show you a simple way to add this to your website or blog so your users can find what they need in style. I think that this kind of thing should be implemented more often for how easy it is to implement.</p>
<h2>Search Results JavaScript code:</h2>
<pre class="brush: jscript;">
function highlightOnLoad() {
  // Get search string
  if (/s\=/.test(window.location.search)) {
    var searchString = getSearchString();
    // Starting node, parent to all nodes you want to search
    var textContainerNode = document.getElementById(&quot;content&quot;);

    // Informational message for search
    var searchInfo = 'Search Results for: ';

    // Split search terms on '|' and iterate over resulting array
    var searchTerms = searchString.split('|');
    for (var i in searchTerms) 	{
      // The regex is the secret, it prevents text within tag declarations to be affected
      var regex = new RegExp(&quot;&gt;([^&lt;]*)?(&quot;+searchTerms[i]+&quot;)([^&gt;]*)?&lt;&quot;,&quot;ig&quot;);
      highlightTextNodes(textContainerNode, regex, i);
      // Add to info-string
      searchInfo += ' &lt;span class=&quot;highlighted term'+i+'&quot;&gt;'+searchTerms[i]+'&lt;/span&gt; ';
    }

    // Create div describing the search
    var searchTermDiv = document.createElement(&quot;H2&quot;);
    searchTermDiv.className = 'searchterms';
    searchTermDiv.innerHTML = searchInfo;

    // Insert as very first child in searched node
    textContainerNode.insertBefore(searchTermDiv, textContainerNode.childNodes[0]);
  }
}

// Pull the search string out of the URL
function getSearchString() {
  // Return sanitized search string if it exists
  var rawSearchString = window.location.search.replace(/[a-zA-Z0-9\?\&amp;\=\%\#]+s\=(\w+)(\&amp;.*)?/,&quot;$1&quot;);
  // Replace '+' with '|' for regex
  // Also replace '%20' if your cms/blog uses this instead (credit to erlando for adding this)
  return rawSearchString.replace(/\%20|\+/g,&quot;\|&quot;);
}

function highlightTextNodes(element, regex, termid) {
  var tempinnerHTML = element.innerHTML;
  // Do regex replace
  // Inject span with class of 'highlighted termX' for google style highlighting
  element.innerHTML = tempinnerHTML.replace(regex,'&gt;$1&lt;span class=&quot;highlighted term'+termid+'&quot;&gt;$2&lt;/span&gt;$3&lt;');
}

// Call this onload, I recommend using the function defined at: http://untruths.org/technology/javascript-windowonload/
addOnLoad(highlightOnLoad());
</pre>
<h2>Now, the highlighting CSS:</h2>
<pre class="brush: css;">
span.highlighted {
  background-color: #161616;
  font-weight: bold;
}
span.term0 {
  background-color: #161633;
}
span.term1 {
  background-color: #331616;
}
span.term2 {
  background-color: #163316;
}
</pre>
<h2>Code explanation</h2>
<p>First, the <em>highlightOnLoad()</em> function checks <em>window.location.search</em> to see if we need to be running any of this stuff, then calls <em>getSearchString</em> to get a sanitized search string so that nothing funky can happen if, say, the user searches for &#8216;&lt;script&gt;&#8217;. You should really be sanitizing all search inputs at least on the back-end anyway.</p>
<p>Then, the <em>highlightTextNodes</em> function uses a regex replace on our textContainerNode&#8217;s innerHTML. The regex verifies that the text is between a &gt; and a &lt; (and not the other way around). Actually nice and simple!</p>
<h2>Caveats</h2>
<p>This may end up being a bit slow if you are doing this on a LOT of text, but for my blog text, it seems quite snappy to me. Also, the CSS does not bold text inside links, but the background color is there to make it obvious.</p>
<p>What do you think? Try it out on the search box on the upper-right. I&#8217;m hoping for some optimizations in the comments.</p>


<p>Related posts:<ol><li><a href='http://eriwen.com/javascript/measure-ems-for-layout/' rel='bookmark' title='Permanent Link: Javascript: Measure those &#8220;em&#8221;s for your layout'>Javascript: Measure those &#8220;em&#8221;s for your layout</a></li>
<li><a href='http://eriwen.com/javascript/stacktrace-update/' rel='bookmark' title='Permanent Link: Javascript Stacktrace update'>Javascript Stacktrace update</a></li>
<li><a href='http://eriwen.com/javascript/change-text-size-onclick-with-javascript/' rel='bookmark' title='Permanent Link: Guest Post: change text size onclick with JavaScript'>Guest Post: change text size onclick with JavaScript</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/javascript/highlight-search-results-with-js/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Guest Post: change text size onclick with JavaScript</title>
		<link>http://eriwen.com/javascript/change-text-size-onclick-with-javascript/</link>
		<comments>http://eriwen.com/javascript/change-text-size-onclick-with-javascript/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 13:45:37 +0000</pubDate>
		<dc:creator>Eric Wendelin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[guest post]]></category>

		<guid isPermaLink="false">http://eriwen.com/javascript/change-text-size-onclick-with-javascript/</guid>
		<description><![CDATA[I have been featured on the <a href="http://davidwalsh.name/" target="_blank">David Walsh Blog</a> with a post telling you how to <a href="http://davidwalsh.name/change-text-size-onclick-with-javascript" target="_blank">Change Text Size On Click With Javascript</a>. My code and explanation is there, but I do have a nice sample of the script in action.



Related posts:<ol><li><a href='http://eriwen.com/javascript/text-size-prefs/' rel='bookmark' title='Permanent Link: Guest Post: Save Text Size Preference Using MooTools and PHP'>Guest Post: Save Text Size Preference Using MooTools and PHP</a></li>
<li><a href='http://eriwen.com/tools/guest-post-on-caching-and-htaccess/' rel='bookmark' title='Permanent Link: Guest post on caching and .htaccess'>Guest post on caching and .htaccess</a></li>
<li><a href='http://eriwen.com/javascript/ppk-on-javascript/' rel='bookmark' title='Permanent Link: Staples of the Bookshelf: ppk on JavaScript'>Staples of the Bookshelf: ppk on JavaScript</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I have been featured on the <a href="http://davidwalsh.name/" target="_blank">David Walsh Blog</a> with a post telling you how to <a href="http://davidwalsh.name/change-text-size-onclick-with-javascript" target="_blank">Change Text Size On Click With Javascript</a>. My code and explanation is there, but I do have a nice sample of the script in action.</p>
<p>Share your thoughts in the comments!</p>
<p><span style="padding: 2px 5px; background-color: #000000; float: right"><a href="javascript:void(0);" onclick="resizeText(1)" id="plustext">Make text bigger</a> | <a href="javascript:void(0);" onclick="resizeText(-1)" id="minustext">Make text smaller</a></span><br />
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr,  sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr,  sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
<p><script type="text/javascript"> var c = document.getElementById("content"); function resizeText(multiplier) { if (c.style.fontSize == "") { c.style.fontSize = "1.0em"; } c.style.fontSize = parseFloat(c.style.fontSize) + (multiplier * 0.2) + "em"; } </script></p>


<p>Related posts:<ol><li><a href='http://eriwen.com/javascript/text-size-prefs/' rel='bookmark' title='Permanent Link: Guest Post: Save Text Size Preference Using MooTools and PHP'>Guest Post: Save Text Size Preference Using MooTools and PHP</a></li>
<li><a href='http://eriwen.com/tools/guest-post-on-caching-and-htaccess/' rel='bookmark' title='Permanent Link: Guest post on caching and .htaccess'>Guest post on caching and .htaccess</a></li>
<li><a href='http://eriwen.com/javascript/ppk-on-javascript/' rel='bookmark' title='Permanent Link: Staples of the Bookshelf: ppk on JavaScript'>Staples of the Bookshelf: ppk on JavaScript</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eriwen.com/javascript/change-text-size-onclick-with-javascript/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
