I don't know why I cannot remove any XML nodes at all.
I am running a javascript/jquery script using date parameters to delete old content from the rss feed created using xml. The moCheck function is as follows:
//monthly check of posts function moCheck(){ //date parameters var xml = xmlDoc.getElementsByTagName("pubDate")[0].childNodes[0].nodeValue; var date = new Date(); var runOn = new Date(date.setDate(1));//set date to do the search for expired posts - 14th of every month - subject to change to 1st var expire = new Date(date.getTime() - (90 * 24 * 60 * 60 * 1000));//expires in 90 days (90 * 24 * 60 * 60 * 1000) var pubDates = new Date(xml);//dates for xml pubDate tag var months = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");//month format = pubDate month format var string = pubDates.getDate() + " " + months[pubDates.getMonth()] + " " + pubDates.getFullYear();//the date format currently displayed in rss var removeItem = $("item", xmlDoc).remove(); if(pubDates > expire){ $('string').removeItem; alert("On " + runOn + ", expired date = " + expire + ", the amt of items to be deleted are: " + string.length); } } window.onload = moCheck; I tried using a backwards loop + splice, .remove(), removeChild, parentNode.removeChild, .empty, etc, etc, but nothing is being removed. I wanna know how can I make the nodes that have the date parameters above stop displaying on my html template. Please help...
No comments:
Post a Comment