<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>RSS feed for InstantSpot site Blog of Dave</title><link>http://daveshuck.instantspot.com</link><description>Dave Shuck&apos;s ramblings on - Software Development, Outdoors, and Life</description><language>en-us</language><copyright>This work is Copyright &#xA9; 2010 by Blog of Dave</copyright><generator>RSSVille ColdFusion FeedMaker, version 1.0</generator><pubDate>Tue, 07 Sep 2010 06:55:40 GMT</pubDate><item><title>Related checkbox validation with JQuery</title><link>http://daveshuck.instantspot.com/blog/2008/07/16/Related-checkbox-validation-with-JQuery/</link><description>&lt;p&gt;I was given a problem yesterday where I needed to do the following client-side validation.  If a user selects a checkbox that they wish to enable credit card transactions, I need to display a panel of specific credit card companies and they need to select at least one before submitting.&lt;/p&gt; &lt;p&gt;If you think about writing the JS to do this without a library it is a somewhat lengthy task.  In essence, you would need to do some type of an onsubmit function on your form, check the value of the key checkbox.  If it was checked, check the value of each credit card checkbox to see if the user had selected one of the children.  After writing this in JQuery, I thought it might be worth demonstrating what an easy task this is.&lt;/p&gt; &lt;p&gt;Let&apos;s start with the specific part of my form that has my checkboxes:&lt;div class=&quot;code&quot; &gt;&lt;pre&gt;&amp;lt;label for=&amp;quot;RequireCCInfo&amp;quot;&amp;gt;Require Credit Card Information?&amp;lt;/label&amp;gt; &amp;lt;input name=&amp;quot;RequireCCInfo&amp;quot; id=&amp;quot;RequireCCInfo&amp;quot; value=&amp;quot;1&amp;quot; type=&amp;quot;checkbox&amp;quot;&amp;gt; &amp;lt;div id=&amp;quot;CreditCardCompanyPanel&amp;quot;&amp;gt;  &amp;lt;div&amp;gt;   &amp;lt;input id=&amp;quot;ccAmex&amp;quot; class=&amp;quot;ccCheckBox&amp;quot; value=&amp;quot;1&amp;quot; type=&amp;quot;checkbox&amp;quot;&amp;gt;   &amp;lt;label for=&amp;quot;ccAmex&amp;quot;&amp;gt;American Express&amp;lt;/label&amp;gt;  &amp;lt;/div&amp;gt;  &amp;lt;div&amp;gt;   &amp;lt;input id=&amp;quot;ccVisa&amp;quot; class=&amp;quot;ccCheckBox&amp;quot; value=&amp;quot;1&amp;quot; type=&amp;quot;checkbox&amp;quot;&amp;gt;   &amp;lt;label for=&amp;quot;ccVisa&amp;quot;&amp;gt;Visa&amp;lt;/label&amp;gt;  &amp;lt;/div&amp;gt;  &amp;lt;div&amp;gt;   &amp;lt;input id=&amp;quot;ccDiscover&amp;quot; class=&amp;quot;ccCheckBox&amp;quot; value=&amp;quot;1&amp;quot; type=&amp;quot;checkbox&amp;quot;&amp;gt;   &amp;lt;label for=&amp;quot;ccDiscover&amp;quot;&amp;gt;Discover&amp;lt;/label&amp;gt;  &amp;lt;/div&amp;gt;  &amp;lt;div&amp;gt;   &amp;lt;input id=&amp;quot;ccMc&amp;quot; class=&amp;quot;ccCheckBox&amp;quot; value=&amp;quot;1&amp;quot; type=&amp;quot;checkbox&amp;quot;&amp;gt;   &amp;lt;label for=&amp;quot;ccMc&amp;quot;&amp;gt;Master Card&amp;lt;/label&amp;gt;        &amp;lt;/div&amp;gt; &amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;There is nothing too notable in all of that other than the fact that you should notice that I have added a class &amp;quot;ccCheckBox&amp;quot; to all of my dependent checkboxes.  I will explain more on that in a bit, but I wanted to point out that it is there.  You will also notice that I am not doing anything in the way of hiding the &amp;quot;CreditCardCompanyPanel&amp;quot; div.  We need to determine at request time whether that will be hidden or not based on whether the &amp;quot;RequireCCInfo&amp;quot; checkbox is checked.&lt;/p&gt; &lt;p&gt;Now, here is the fun part...  I am including the JS that I use for this task below:&lt;div class=&quot;code&quot; &gt;&lt;pre&gt;&amp;lt;script language=&amp;quot;javascript&amp;quot;&amp;gt;  (document).ready(function(){  $(&amp;quot;#RequireCCInfo&amp;quot;).change(function(){   toggleCreditCardCompanyPanel();  });    function toggleCreditCardCompanyPanel() {   if ($(&amp;quot;#RequireCCInfo&amp;quot;).attr(&amp;quot;checked&amp;quot;) == true)  $(&amp;quot;#CreditCardCompanyPanel&amp;quot;).show();    else $(&amp;quot;#CreditCardCompanyPanel&amp;quot;).hide();  }  $(&amp;quot;#SaveButton&amp;quot;).click(function(){   var pass = false;   if ($(&amp;quot;#RequireCCInfo&amp;quot;).attr(&amp;quot;checked&amp;quot;) == true){    $(&amp;quot;.ccCheckBox&amp;quot;).each(function() {                   if ($(this).attr(&amp;quot;checked&amp;quot;) == true) pass = true;               });   }   else pass = true;   if (pass) $(&amp;quot;#frmMyForm&amp;quot;).submit();   else alert(&apos;You must select at least on credit card company if &amp;quot;Require Credit Card Information&amp;quot; is checked.&apos;);  });   toggleCreditCardCompanyPanel(); }); &amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;First, by using the $(document).ready() function we are telling JQuery to run this JS once the DOM has been completely loaded.  Let&apos;s look at each section within that ready() block...&lt;/p&gt; &lt;p&gt;The first thing you will see is the $(&amp;quot;#RequireCCInfo&amp;quot;).change() method.  JQuery gives us the concept of binding a listener to an element.  For our example, this listener says that anytime that an element with an ID of &amp;quot;RequireCCInfo&amp;quot; is changed, that we will run the code in its function().  You will see that anytime our &amp;quot;RequireCCInfo&amp;quot; checkbox is changed we are going to run a function called toggleCreditCardCompanyPanel().   As you can see we have that method defined immediately after our &amp;quot;RequireCCInfo&amp;quot; checkbox.&lt;/p&gt; &lt;p&gt;In our toggleCreditCardCompanyPanel() method, we are making the decision as to whether or not our &amp;quot;CreditCardCompanyPanel&amp;quot; will be displayed based on whether our user has decided to check the box labeled &amp;quot;Require Credit Card Information?&amp;quot;.   By using the JQuery selectors we are in essence saying:  If a checkbox with an ID of &amp;quot;RequireCCInfo&amp;quot; is checked, display an element with the ID &amp;quot;CreditCardCompanyPanel&amp;quot;.  Otherwise we will hide this element.&lt;/p&gt; &lt;p&gt;Next comes our validation on form submit... and pretty cool stuff!&lt;/p&gt; &lt;p&gt;Basically I have added a listener which is bound to our submit button with the ID of &amp;quot;SaveButton&amp;quot; which will submit our form &amp;quot;frmMyForm&amp;quot;.   Anytime that this button is clicked, we will run the code in the function() block.   We start this function by setting a value pass=false.  We will use this variable to determine whether our form has passed validation.  Next we get just a small taste of the magic of JQuery selectors.    First, as we did in the toggleCreditCardCompanyPanel() function, we are determining if the element with the ID of &amp;quot;RequireCCInfo&amp;quot; is checked.  If so, by using the each() function, we are going to loop through all elements on the page with the class &amp;quot;ccCheckBox&amp;quot; (remember that from above?).  In each iteration of the loop we are going to determine if the element has been checked.  If so, we are going to set pass=true since we know that our validation has passed.&lt;/p&gt; &lt;p&gt;Lastly, now that we have determined that our form is either going to pass/fail, we take the appropriate action.  If pass==fail, we are simply going to alert a message telling the user that if they are going to enable credit cards that they have to choose at least one credit card company.  Otherwise, we are going to call the submit() method on our form.&lt;/p&gt; &lt;p&gt;I almost took the time to write out the equivalent of this in POJS (plain old JavaScript) to show how much easier life is with JQuery, but I realized I didn&apos;t have the time, patience, or will.  JQuery has spoiled me!&lt;/p&gt;</description><pubDate>Wed, 16 Jul 2008 14:41:00 GMT</pubDate><guid>http://daveshuck.instantspot.com/blog/2008/07/16/Related-checkbox-validation-with-JQuery/</guid><category>ColdFusion,Javascript,Tips and Tricks</category></item><item><title>Javascript library of ColdFusion functions</title><link>http://daveshuck.instantspot.com/blog/2007/04/26/Javascript-library-of-ColdFusion-functions/</link><description>&lt;p&gt;  I often find myself working in Javascript and thinking &amp;quot;Man I wish there was a JS equivalent of the CFML xyz() method!&amp;quot;  Tonight was one of those nights as I was about to make my own ListAppend() method.  Instead, I came across a Javascript library that is collection of ColdFusion functions ported into Javascript, written by a guy named &lt;a href=&quot;http://www.leftcorner.com&quot;&gt;Randy Anderson&lt;/a&gt;.   If you are ever looking for any of the functions listed below, go check out Randy&amp;#39;s &lt;a href=&quot;http://www.leftcorner.com/index.cfm?Article=JavaScript_library_of_ColdFusion_functions&quot;&gt;Javscript Library of ColdFusion Functions&lt;/a&gt;.  &lt;/p&gt;  &lt;p&gt;  Here is the list of functions included in the library:  &lt;/p&gt;  &lt;pre&gt;  Abs(number)&lt;br /&gt;  ArrayAppend(array, value)&lt;br /&gt;  ArrayLen(array)&lt;br /&gt;  ArraySort(array, sort_type [, sort_order ])&lt;br /&gt;  ArrayToList(array [, delimiter ])&lt;br /&gt;  Ceiling(number)&lt;br /&gt;  Compare(string1, string2)&lt;br /&gt;  CompareNoCase(string1, string2)  &lt;br /&gt;  DateDiff(datepart, date1, date2)&lt;br /&gt;  DecimalFormat(number)&lt;br /&gt;  DollarFormat(number)&lt;br /&gt;  Find(substring, string)&lt;br /&gt;  FindNoCase(substring, string)&lt;br /&gt;  Insert(substring, string, position)&lt;br /&gt;  IsDate(date)&lt;br /&gt;  IsNumeric(string)&lt;br /&gt;  LCase(string)&lt;br /&gt;  Left(string, count)&lt;br /&gt;  Len(sting)&lt;br /&gt;  ListAppend(list, value, [, delimiters])&lt;br /&gt;  ListDeleteAt(list, position [, delimiters ])&lt;br /&gt;  ListFind(list, value [, delimiters ]))&lt;br /&gt;  ListFindNoCase(list, value [, delimiters ]))&lt;br /&gt;  ListGetAt(list, position [, delimiters ]))&lt;br /&gt;  ListLen(list [, delimiters])&lt;br /&gt;  ListToArray(list [, delimiters])&lt;br /&gt;  LTrim(string)&lt;br /&gt;  Mid(string, start, count)&lt;br /&gt;  Replace(string, substring1, substring2 [, scope ])&lt;br /&gt;  ReplaceNoCase(string, substring1, substring2 [, scope ])&lt;br /&gt;  Reverse(string)&lt;br /&gt;  Right(string, count)&lt;br /&gt;  Round(number [, number of decimal places])&lt;br /&gt;  RTrim(string)&lt;br /&gt;  Trim(string)&lt;br /&gt;  UCase(string)&lt;br /&gt;  URLDecode(string)&lt;br /&gt;  URLEncodedFormat(string)  &lt;/pre&gt;  </description><pubDate>Fri, 27 Apr 2007 01:51:45 GMT</pubDate><guid>http://daveshuck.instantspot.com/blog/2007/04/26/Javascript-library-of-ColdFusion-functions/</guid><category>Javascript</category></item><item><title>Evidence Item #12826 in the case of Microsoft VS Web Developers</title><link>http://daveshuck.instantspot.com/blog/2007/03/29/Evidence-Item-12826-in-the-case-of-Microsoft-VS-Web-Developers/</link><description>&lt;p&gt;  I feel like a &lt;a href=&quot;http://www.washingtonpost.com/wp-dyn/content/article/2005/09/03/AR2005090300165.html&quot;&gt;misguided &lt;span class=&quot;hm&quot;&gt;Kanye&lt;/span&gt; West&lt;/a&gt;  proclaiming &amp;quot;Bill Gates doesn&amp;#39;t care about web people!&amp;quot;, but  seriously...  What is it?  Why is it so hard to just follow the same  standard that other browsers don&amp;#39;t seem to have such a hard time with?  &lt;/p&gt;  &lt;p&gt;  After  my 3rd Internet Explorer specific problem in about 24 hours, I had to  share this one since it is very easy to demonstrate, and I am sure that  someone will bang their head on it in the future.   I have come to the  conclusion that without some hack workaround of setting temp javascript  variables, it is not possible to scrub the value of a form field with  an &lt;span class=&quot;hm&quot;&gt;onKeyUp&lt;/span&gt; event, and then take action on that scrubbed value at  &lt;span class=&quot;hm&quot;&gt;onChange&lt;/span&gt;.    &lt;/p&gt;  &lt;p&gt;  Here is a simple example:  &lt;/p&gt;  &lt;p&gt;  [codeshare mare9751]   &lt;/p&gt;  &lt;p&gt;  The  idea behind that code is that with each keystroke, we are going to pull  out invalid characters from the field.  Then on our update, we are  going to do something with that value.  Presumably, that would be  something more helpful than an alert, such as in my case where I wanted  to do an Ajax update to a session scoped bean that was child of a user  facade, but you get the idea.  This works in &lt;span class=&quot;hm&quot;&gt;Firefox&lt;/span&gt; and Opera without  a hitch.  IE6?  nope.  IE7?  nope...   &lt;/p&gt;  &lt;p&gt;  I wondered if it might have  been simply a problem with the way that I was modifying the string and  then returning it.  So I tried just returning the original string like  this:  &lt;/p&gt;  &lt;p&gt;  [codeshare marfaf45]  &lt;/p&gt;  &lt;p&gt;  Nope... still the same.   &lt;/p&gt;  &lt;p&gt;  So  what the hell is going on here?  At this point I had a suspicion that  it had to do with the fact that we are resetting the value of the field  before the onChange, which I confirmed with this:  &lt;/p&gt;  &lt;p&gt;  [codeshare mar08dc7]   &lt;/p&gt;  &lt;p&gt;  So  there it is... Apparently, Microsoft does not think that you ought to  be able to alter a field&amp;#39;s data with onKeyUp, and then do something  onChange.  For what it is worth I found that this exact same behavior  happens with TMT_Validator when using field filtering.   I used to feel  that this was an issue with TMT itself, but obviously it is IE itself.  &lt;/p&gt;  &lt;p&gt;  So... a big thanks to IE Team for once again killing part of my day.   &lt;/p&gt;  </description><pubDate>Thu, 29 Mar 2007 19:20:49 GMT</pubDate><guid>http://daveshuck.instantspot.com/blog/2007/03/29/Evidence-Item-12826-in-the-case-of-Microsoft-VS-Web-Developers/</guid><category>Javascript</category></item><item><title>Javascript examples - removeElement() and replaceAll()</title><link>http://daveshuck.instantspot.com/blog/2006/12/13/Javascript-examples--removeElement-and-replaceAll/</link><description>&lt;p&gt;I am currently working on a heavily Ajax-injected loan application project.  This morning I created a couple of Javascript menthods that I thought might be useful to others. First is one named replaceAll() that will replace all instances of a substring within a string.  Secondly is a removeElement() function that will remove a DOM element based on its ID.  I am sure that some Javascript gurus out there are going to correct me on my approach, but these are functional and will hopefully save someone some time.  &lt;/p&gt;    &lt;p&gt;First is my: &lt;div style=&quot;font-weight:bold;&quot;&gt;replaceAll([original string],[find string],[replace string])&lt;/div&gt;&lt;/p&gt;    &lt;div class=&quot;note&quot;&gt;  &lt;code&gt;  function replaceAll(OldString,FindString,ReplaceString) {     var SearchIndex = 0;     var NewString = &quot;&quot;;      while (OldString.indexOf(FindString,SearchIndex) != -1)    {       NewString += OldString.substring(SearchIndex,OldString.indexOf(FindString,SearchIndex));       NewString += ReplaceString;       SearchIndex = (OldString.indexOf(FindString,SearchIndex) + FindString.length);             }     NewString += OldString.substring(SearchIndex,OldString.length);     return NewString;  }  &lt;/code&gt;  &lt;/div&gt;    &lt;p&gt;&lt;/p&gt;   &lt;p&gt;Next up is:  &lt;div style=&quot;font-weight:bold;&quot;&gt;removeElement([element ID])&lt;/div&gt;  &lt;div class=&quot;note&quot;&gt;  &lt;code&gt;  function removeElement(id) {   var Node = document.getElementById(id);   Node.parentNode.removeChild(Node);  }  &lt;/code&gt;  &lt;/div&gt;  &lt;/p&gt;    &lt;p&gt;If anyone has a better approach for either of these, I am all ears.&lt;/p&gt;         &lt;h2&gt;EDIT:&lt;/h2&gt;  &lt;p&gt;That didn&apos;t take long!  &lt;a href=&quot;http://www.richardleggett.co.uk/&quot;&gt;Richard Leggett&lt;/a&gt; posted a much cleaner solution to replaceAll() in the comments below.  Just to make sure no one misses it, I am adding it here:  &lt;div class=&quot;note&quot;&gt;  &lt;code&gt;  function replaceAll( str, searchTerm, replaceWith, ignoreCase ) {   var regex = &quot;/&quot;+searchTerm+&quot;/g&quot;;   if( ignoreCase ) regex += &quot;i&quot;;   return str.replace( eval(regex), replaceWith );  }  &lt;/code&gt;  &lt;/div&gt;    &lt;/p&gt; </description><pubDate>Wed, 13 Dec 2006 18:14:32 GMT</pubDate><guid>http://daveshuck.instantspot.com/blog/2006/12/13/Javascript-examples--removeElement-and-replaceAll/</guid><category>Javascript</category></item><item><title>InnerHTML no more!  Swapping content using the DOM.</title><link>http://daveshuck.instantspot.com/blog/2006/10/19/InnerHTML-no-more--Swapping-content-using-the-DOM/</link><description>   Companions to this post:  &lt;ul&gt;   &lt;li&gt;&lt;a href=&quot;http://www.worldwildweb.biz/dave/divswap/divswap.html&quot;&gt;Example Page&lt;/a&gt;&lt;/li&gt;   &lt;li&gt;&lt;a href=&quot;http://www.worldwildweb.biz/dave/divswap/divswap.zip&quot;&gt;Example Code&lt;/a&gt;&lt;/li&gt;  &lt;/ul&gt;  &lt;p&gt;Although it is very common to see swappable divs in web applications, it is remarkable how many times you see the innerHTML property of an element used to either insert or remove content from an element.  Why is this remarkable?  The innerHTML property is not part of the current HTML specification, in part due to the fact that it can render content invalid for assitive technologies that support scripting.&lt;/p&gt;    &lt;p&gt;Even the majority of the Ajax frameworks that I have been exposed to seem to make liberal use of innerHTML.  I am not suggesting in anyway that it is &quot;wrong&quot; to use it, and I have certainly used it on occasion, but for those interested in staying with the HTML 4.0 specs, there are other ways to accomplish the same result.&lt;/p&gt;      &lt;p&gt;Using the DOM your document is nothing more than a series of parent/child relationships, which you can traverse through using native Javascript methods that are part of each element.  For instance, say I have the following div hierarchy:&lt;/p&gt;    &lt;p&gt;  &lt;div class=&quot;note&quot;&gt;  &lt;code&gt;  &lt;div style=&quot;background-color:#000000&quot;&gt;   &lt;div id=&quot;Child1&quot;&gt;&lt;/div&gt;   &lt;div id=&quot;Child2&quot;&gt;&lt;/div&gt;  &lt;/div&gt;  &lt;/code&gt;  &lt;/div&gt;  &lt;/p&gt;      &lt;p&gt;If I wanted to find out the background color of the parent div of &quot;Child2&quot;, I could access it like this:&lt;/p&gt;    &lt;p&gt;  &lt;div class=&quot;note&quot;&gt;  &lt;code&gt;  document.getElementById(&quot;Child2&quot;).parentNode.style.backgroundColor  &lt;/code&gt;  &lt;/div&gt;  &lt;/p&gt;    &lt;p&gt;You can go up or down throughout the entire hierarchy using parentNode and childNodes (array) properties.  Once you get into the mindset that everything is part of a bigger whole and has its own space in the relationship, it becomes simpler to get your head around working with the DOM.&lt;/p&gt;    &lt;p&gt;I have put together a small example showing how to create swappable divs using only the DOM and valid scripting as an example for those interested. The basic idea in this example is that we have a display div named DisplayContainer where our dynamic content will be displayed.  We also have a hidden div named HoldingContainer.  Within that div, we store the divs that that will be displayed in the DisplayContainer div on various onclick actions.&lt;/p&gt;    &lt;p&gt;As we click on various items, we call a function named wwwWriteContent which accepts an object argument that is to be displayed in the content container.  That method first loops through its childNodes and sends any children back to the HoldingContainer div.  It does this by saying &quot;as long as the condition exists that the DisplayContainer has a first child, send that child to the holding container and repeat&quot;.  When this loop finishes, it then moves the object argument into the display container so that it is displayed.&lt;/p&gt;      &lt;p&gt;In this code you will also see another helpful function wwwClearElement() which accepts an object argument as well.  It runs a similar loop but rather than moving children to another location, it simply erases them permanently from the document.&lt;/p&gt;    &lt;p&gt;So with that preface, let&apos;s walk through the code.  In the head of our document, we are going to define the functions I described above:&lt;/p&gt;      &lt;p&gt;  &lt;div class=&quot;note&quot;&gt;  &lt;code&gt;  // this function clears all child elements out of the object that is passed in  function wwwClearElement(obj) {   while(obj.firstChild) obj.removeChild(obj.firstChild);  }      // this function sends any child objects back into the &apos;HoldingContainer&apos; div  function wwwWriteContent(contentObject) {   // Here we will define our Containers   // this is the display container   var ContentContainer = document.getElementById(&quot;DisplayContainer&quot;);   // this is a repository for divs not currently in the display   var ContentHolding = document.getElementById(&quot;HoldingContainer&quot;);   // send any children objects currently in the display to the holding div   while(ContentContainer.firstChild) {    ContentHolding.appendChild(ContentContainer.firstChild);   }   // put the active content in thd display div   ContentContainer.appendChild(contentObject);  }  &lt;/code&gt;  &lt;/div&gt;  &lt;/p&gt;      &lt;p&gt;Hopefully with the inline comments and the description above, that Javascript makes sense to you at this point.  Now that we have defined, we can walk through the body of the document.  First, let&apos;s take a look at the HoldingContainer div.&lt;/p&gt;      &lt;p&gt;  &lt;div class=&quot;note&quot;&gt;  &lt;code&gt;  &lt;div id=&quot;HoldingContainer&quot; style=&quot;display:none;&quot;&gt;   &lt;div id=&quot;divHelloWorld&quot;&gt;Hello World&lt;/div&gt;   &lt;div id=&quot;divCassidy&quot;&gt;    &lt;div&gt;Here is a picture:&lt;/div&gt;    &lt;div&gt;&lt;img src=&quot;http://www.instantspot.com/userfiles/073006/91/100_7776.JPG&quot;&gt;&lt;/div&gt;   &lt;/div&gt;     &lt;div id=&quot;divCloseMe&quot;&gt;    &lt;input value=&quot;bye!&quot; type=&quot;button&quot; onclick=&quot;wwwClearElement(document.getElementById(&apos;DisplayContainer&apos;))&quot;&gt;    &lt;div&gt;(kills this div until page refresh rather than putting back into the holding div)&lt;/div&gt;   &lt;/div&gt;  &lt;/div&gt;    &lt;/code&gt;  &lt;/div&gt;  &lt;/p&gt;    &lt;p&gt;You can see that the outer div HoldingContainer is set to &quot;display:none&quot;.  This means that it, nor any of its child nodes within can be viewed.  You may also notice our suicidal div &quot;divCLoseMe&quot;.  The button within it calls our wwwClearElement() function, wiping itself off the face of the earth.&lt;/p&gt;    &lt;p&gt;Next we create some links:&lt;/p&gt;    &lt;p&gt;  &lt;div class=&quot;note&quot;&gt;  &lt;code&gt;  &lt;div style=&quot;padding: 20px; float: left;&quot;&gt;&lt;a href=&quot;javascript:;&quot; onclick=&quot;wwwWriteContent(document.getElementById(&apos;divHelloWorld&apos;));&quot;&gt;Say Hello&lt;/a&gt;&lt;/div&gt;  &lt;div style=&quot;padding: 20px; float: left;&quot;&gt;&lt;a href=&quot;javascript:;&quot; onclick=&quot;wwwWriteContent(document.getElementById(&apos;divCassidy&apos;));&quot;&gt;Smile&lt;/a&gt;&lt;/div&gt;  &lt;div style=&quot;padding: 20px; float: left;&quot;&gt;&lt;a href=&quot;javascript:;&quot; onclick=&quot;wwwWriteContent(document.getElementById(&apos;divCloseMe&apos;));&quot;&gt;Self-loathing Div&lt;/a&gt;&lt;/div&gt;  &lt;/code&gt;  &lt;/div&gt;  &lt;/p&gt;    &lt;p&gt;You can see that each of those links call our wwwWriteConent() function and pass the object that we wish to be displayed in our DisplayContainer.&lt;/p&gt;    &lt;p&gt;  &lt;div class=&quot;note&quot;&gt;  &lt;code&gt;  &lt;div style=&quot;border: 1px dashed #cccccc; padding: 20px; clear: both;&quot;&gt;   Here is where we will show our dynamic content:   &lt;div id=&quot;DisplayContainer&quot;&gt;&lt;/div&gt;  &lt;/div&gt;   &lt;/code&gt;  &lt;/div&gt;  &lt;/p&gt;    &lt;p&gt;That is it!  Hopefully from this you will go on and play with the childNodes array, and practice walking up and down the object heirarchy in some of your own code.       </description><pubDate>Thu, 19 Oct 2006 14:52:47 GMT</pubDate><guid>http://daveshuck.instantspot.com/blog/2006/10/19/InnerHTML-no-more--Swapping-content-using-the-DOM/</guid><category>Javascript</category></item><item><title>Grand Canyon... It&apos;s on!</title><link>http://daveshuck.instantspot.com/blog/2005/07/11/Grand-Canyon-Its-on/</link><description>My father and I decided that this was the year that we would hike the North Rim to the South Rim of the Grand Canyon.   I know this seems crazy, but it is actually a paperwork challenge to be able to hike the Grand Canyon.  There is an application process in which you have to fax your request in the 1st day of the month 6 months before the intended date of your trip with a detailed itinerary, including where you will be sleeping and when.  We sent faxed our paperwork in and held our breath on the 1st of April, 6 months before we hoped to go in September.  After no word for a month we finally contacted them, only to find out that we had been rejected.  Discouraged, but not beaten, we laid out the calendar to see if there was another time that would work.  We decided that November would be acceptable, albeit a little colder.  It should be in the 60s in the bottom of the canyon though where we will spend the majority of our time.  Once again, we laid out our itinerary and faxed in on July 1.  My dad received a letter today dated July 6, 2005 telling him that they were sorry, but they were unable to accept out application.  He spent a good hour walking around the house cussing and feeling terribly disappointed.  A bit later my mom noticed there was another letter from the Grand Canyon dated July 7, 2005.  &lt;br /&gt;  &lt;br /&gt;  &lt;div class=&quot;note&quot;&gt;  Dear Mr. Shuck, we have accepted your request to hike the Grand Canyon on the dates of November 1, 2 and 3, 2005.  Enlcosed are your passes, which you will need to affix to your backpack and carry with you in the canyon.  There is no need to stop by the back country headquarters before departing on the trail.  &lt;/div&gt;  So in 3.5 months, I will be taking this in....&lt;br /&gt;  &lt;div style=&quot;text-align: center&quot;&gt;  &lt;img src=&quot;/images/GrandCanyon.jpg&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;  &lt;/div&gt;      </description><pubDate>Mon, 11 Jul 2005 05:00:00 GMT</pubDate><guid>http://daveshuck.instantspot.com/blog/2005/07/11/Grand-Canyon-Its-on/</guid><category>Outdoors</category></item></channel></rss>