View Single Post
Old 10-31-2012, 08:58 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,168
Thanks: 59
Thanked 3,993 Times in 3,962 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Why why why would you code this:
Code:
//<![CDATA[
      function showData(oTab)
      {
        //get the display container
        var oContainer = document.getElementById('tab_content');
        //get the required data for display
        var oDataContainer = document.getElementById(oTab.id + '_content');
        //empty the display container;
        oContainer.innerHTML = "";
        //fill it up
        oContainer.innerHTML = oDataContainer.innerHTML;
      }
Why copy the contents from a hidden <div> to a visible <div> instead of just changing WHICH <div> is shown and which is hidden????

Because you copy from the hidden div to the visible div, *OF COURSE* you then WIPE OUT whatever was entered before! Because you are copying the *ORIGINAL* contents, again, and they did NOT contain any filled out field!
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote