Lost functionality after local storage
<p>Hi I am storing a table with clickable image entries in local storage. However, obviously when I recall the table data and append it I have a new table as such, so I lose the click and image selection option for the user although the data entered previous to the save is there. If I want to check the image source on the new table, can that be done? My thinking is that I will have to write the click functionality again for the new table, but obviously I only want to apply this to the cells that haven't already been filled. Or if anyone can see a better solution I would be grateful. Thanks. </p>

<pre><code>   function makeChart() {
    table = document.createElement('table');
    var taskName = document.getElementById('taskname').value,
    header = document.createElement('th'),
    numDays = document.getElementById('days').value, //columns
    howOften = document.getElementById('times').value, //rows
    row,
    r,
    col,
    c;


var cel = null;
var myImages = new Array();
myImages[0] = "http://www.olsug.org/wiki/images/9/95/Tux-small.png";
myImages[1] = "http://a2.twimg.com/profile_images/1139237954/just-logo_normal.png";
var my_div = document.createElement("div");
my_div.id = "showPics";
document.body.appendChild(my_div);
var newList = document.createElement("ul");
my_div.appendChild(newList);

if (taskName == '' || numDays == '') {
    alert('Please enter task name and number of days');
}
if (howOften == '') {
    howOften = 1;
}
if (taskName != '' &amp;&amp; numDays != '') {

    for (var i = 0; i &lt; myImages.length; i++) {
        var allImages = new Image();
        allImages.src = myImages[i];
        allImages.onclick = function (e) {
            if (sel !== null) {
                sel.src = e.target.src;
                my_div.style.display = 'none';
                sel.onclick = null;
                sel = null;
            }
        };

        var li = document.createElement('ul');
        li.appendChild(allImages);
        newList.appendChild(li);
    }
    my_div.style.display = 'none';

    header.innerHTML = taskName;
    table.appendChild(header);

    function addImage(col) {
        var img = new Image();
        img.src = "http://cdn.sstatic.net/stackoverflow/img/tag-adobe.png";
        col.appendChild(img);
        img.onclick = function () {
            my_div.style.display = 'block';
            sel = img;
        };
    }
    for (r = 0; r &lt; howOften; r++) {
        row = table.insertRow(-1);
        for (c = 0; c &lt; numDays; c++) {
            col = row.insertCell(-1);
            addImage(col);
        }
    }
    document.getElementById('holdTable').appendChild(table);
    document.getElementById('createChart').onclick = null;
   }
  }
function saveData(){
    localStorage.setItem(name, table.innerHTML);
}
function showData(){
var showme = localStorage.getItem(name); 
var newTable = document.createElement('table');
newTable.innerHTML= showme;
newTable.id = "newTable";
var showIt= document.getElementById('holdTable');
showIt.appendChild(newTable);
console.log(showIt); 
}; 
</code></pre>
