// I'm inserting a reminder in the tags here. Every 30 seconds this reminder gets updated. // The update is supposed to erase all the contents of the tags and place the new content in there instead. // What actually happens though is that the reminder appends a newline every 30 secs. So after a few minutes, // I just get a page of blank rows with the text reminder pushed to the bottom.... HTML ...
JS ... ...........building a new tr (this is fine I think) ............ rem_TR = document.createElement('tr'); // go to remno first z = i +3 ; // give this a unique id so we can delete it rem_id='reminder_id_'+cols[z]; rem_TR.setAttribute('id',rem_id); // create the tds rem_text_TD = document.createElement('td'); rem_text_TD.setAttribute('align','left'); rem_text_TD.setAttribute('width','20%'); // reminder time attributes rem_time_TD = document.createElement('td'); rem_time_TD.setAttribute('align','left'); rem_time_TD.setAttribute('width','60%'); // reminder sms attributes rem_sms_TD = document.createElement('td'); rem_sms_TD.setAttribute('align','left'); rem_sms_TD.setAttribute('width','10%'); // delete is handled seperately rem_del_TD = document.createElement('td'); rem_del_TD.setAttribute('width','10%'); // insert the text elements rem_text_TD.appendChild(document.createTextNode(cols[i++])); rem_time_TD.appendChild(document.createTextNode(cols[i++])); rem_sms_TD.appendChild(document.createTextNode(cols[i++])); // create link and add properties rem_del_A = document.createElement('a'); rem_del_A.setAttribute('href','#'); rem_del_A.setAttribute('onclick','kill_reminder('+cols[i]+')'); rem_del_A.appendChild(document.createTextNode('Delete')); rem_del_TD.appendChild(rem_del_A); // append the tds rem_TR.appendChild(rem_text_TD); rem_TR.appendChild(rem_time_TD); rem_TR.appendChild(rem_sms_TD); rem_TR.appendChild(rem_del_TD); ........... appending a tr (this is the problem)............ // append the tr element ... // clear the node first document.getElementById('reminders_box').replaceChild(rem_TR,document.getElementById('reminders_box').firstChild);