title: Undo a javascript function
body: <p>is it possible to undo a function that has been used to manipulate contents inside a <code>&lt;p&gt;</code> ?</p>
  
  <p>These functions:</p>
  
  <pre><code>//Convert input into formated metadata
  function myFunction5() {
    var m1 = document.getElementById("m1")
    var str = m1.innerHTML
    var fields = [
      { regex: /B1/g, id:"bust"},
      { regex: /W1/g, id:"waist"},
      { regex: /H1/g, id:"hips"},
      { regex: /L1/g, id:"lng"},
      { regex: /S1/g, id:"shl"},
      { regex: /S2/g, id:"slv"},
      { regex: /I1/g, id:"ins"},
      { regex: /TITLE/g, id:"title"},
      { regex: /SPECIFICS/g, id:"specifics"},
      { regex: /MERC/g, id:"mercedes"},
      { regex: /SUPPLIER/g, id:"supplier"},
      { regex: /DATE/g, id:"date"},
      { regex: /WEIGHT/g, id:"weight"}]
  
    for (o of fields){
      var val = document.getElementById(o.id).value
      if (val != "")
        str = str.replace(o.regex, val)
      else // remove line
        str = str.replace(
          new RegExp("\\s+"+(typeof o.regex=='string'?o.regex:o.regex.source)+".*?\n")
          ,'')
    }
    m1.innerHTML = str;
  }
  
  //Convert input into formated metadata
  function myFunction6() {
    var m1 = document.getElementById("m1")
    var str = m1.innerHTML
    var fields = [
      { regex: /B2/g, id:"bust"},
      { regex: /W2/g, id:"waist"},
      { regex: /H2/g, id:"hips"},
      { regex: /L2/g, id:"lng"},
      { regex: /S3/g, id:"shl"},
      { regex: /S4/g, id:"slv"},
      { regex: /I2/g, id:"ins"},
      { regex: /SPEC2/g, id:"specifics"},
      { regex: /SUPP2/g, id:"supplier"},
      { regex: /DAT2/g, id:"date"},
      { regex: /WGT2/g, id:"weight"}]
  
    for (o of fields){
      var val = document.getElementById(o.id).value
      if (val != "")
        str = str.replace(o.regex, val)
      else // remove line
        str = str.replace(
          new RegExp("\\s+"+(typeof o.regex=='string'?o.regex:o.regex.source)+".*?\n")
          ,'')
    }
    m1.innerHTML = str;
  }
  </code></pre>
  
  <p>...are using the data within the input/text fields here:</p>
  
  <pre><code>&lt;p id="topmeasurement" align=left&gt;
              &lt;input type="text" class="topm" id="weight" name="weight" placeholder="Weight"&gt;
              &lt;br&gt;
              &lt;input type="text" class="topm" id="supplier" name="supplier" placeholder="Supplier"&gt;
              &lt;br&gt;
              &lt;input type="text" class="topm" id="date" name="date" placeholder="Date"&gt;
              &lt;br&gt;
              &lt;textarea class="topm" id="specifics" name="specifics" placeholder="Specifics" style="height: 30px;"&gt;&lt;/textarea&gt;
              &lt;br&gt;
              &lt;textarea class="topm" id="mercedes" placeholder="Enter Any Aditional Data Here"&gt;&lt;/textarea&gt;
              &lt;br&gt;
              &lt;textarea type="text" class="topm" id="title" name="title" maxlength="80" placeholder="TITLE" style="height: 30px;"&gt;&lt;/textarea&gt;&lt;span id="counter"&gt;&lt;/span&gt;
              &lt;br&gt;
              &lt;br&gt;
          &lt;/p&gt;
          &lt;p id="botmeasurement"&gt;
              &lt;input type="text" class="botm" id="bust" name="bust"&gt;&amp;nbsp;Bust
              &lt;br&gt;
              &lt;input type="text" class="botm" id="waist" name="waist"&gt;&amp;nbsp;Waist
              &lt;br&gt;
              &lt;input type="text" class="botm" id="hips" name="hips"&gt;&amp;nbsp;Hips
              &lt;br&gt;
              &lt;input type="text" class="botm" id="lng" name="lenght"&gt;&amp;nbsp;Lenght
              &lt;br&gt;
              &lt;input type="text" class="botm" id="shl" name="shoulders"&gt;&amp;nbsp;Shoulders
              &lt;br&gt;
              &lt;input type="text" class="botm" id="slv" name="sleeves"&gt;&amp;nbsp;Sleeves
              &lt;br&gt;
              &lt;input type="text" class="botm" id="ins" name="inseam"&gt;&amp;nbsp;Inseam
              &lt;br&gt;
          &lt;/p&gt;
  </code></pre>
  
  <p>...and changing this area using the data from previous fields: </p>
  
  <pre><code>&lt;p id="m1" align=center&gt;bB2 wW2 hH2 lL2 shS3 slvS4 insI2 | SPEC2 | SUPP2 | DAT2 | WGT2
                          &lt;br&gt;
                          &lt;br&gt;TITLE
                          &lt;br&gt;SPECIFICS
                          &lt;br&gt;SUPPLIER | DATE | WEIGHT
                          &lt;br&gt;
                          &lt;br&gt;MERC
                          &lt;br&gt;
                          &lt;br&gt;B1 Bust inches flat&amp;lt;/br&amp;gt;
                          &lt;br&gt;W1 Waist inches flat&amp;lt;/br&amp;gt;
                          &lt;br&gt;H1 Hips inches flat&amp;lt;/br&amp;gt;
                          &lt;br&gt;L1 Length &amp;lt;/br&amp;gt;
                          &lt;br&gt;S1 Shoulders &amp;lt;/br&amp;gt;
                          &lt;br&gt;S2 Sleeves &amp;lt;/br&amp;gt;
                          &lt;br&gt;I1 Inseam &amp;lt;/br&amp;gt;
                          &lt;br&gt;&amp;lt;/FONT&amp;gt;&amp;lt;/p&amp;gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>Is it posible to integrate a "Back" button that would undo the changes to the <code>&lt;p&gt;</code> in question?</p>
  
  <p>Also a working jsfiddle example: <a href="http://jsfiddle.net/jtaex1sd/" rel="nofollow">http://jsfiddle.net/jtaex1sd/</a></p>