page auto-expire does not work

liunx

Guest
Greetings, The Expire HTML page java script does not seem to work either live or local. There is nothing to say WHERE in the <BODY> to place the script, what to do with the orriginal <BODY> tag or if it needs to be split up. I need to be able to auto-expire or auto-delete a page on a specific date. Do I need to change anything in the script other than the GOLIVE and EXPIRE date? Is there an EXAMPLE or a better way???<br />
-- Thanks Wolfman7h<!--content-->If I understand you correctly, you want to remove a page from your server at a specific time. Correct? If so, you will have to use some server side language (PHP, Perl), as javascript can't write to/delete files. Is that what you want to do?<!--content-->I refer to the following script:<br />
<!--<br />
Script Name: Auto Expire<br />
Website URL: <!-- m --><a class="postlink" href="http://javascript.internet.com/calendars/auto-expire.html">http://javascript.internet.com/calendar ... xpire.html</a><!-- m --><br />
Description: Content will only be displayed between the 'Go Live' date and the 'Expires' date. Great for promotions that start on a certain date, and end on another date.<br />
--><br />
<!-- ONE STEP TO INSTALL AUTO EXPIRE:<br />
1. Copy the coding into the BODY of your HTML document --><br />
<!-- STEP ONE: Paste this code into the BODY of your HTML document --><br />
<BODY><br />
<SCRIPT LANGUAGE="JavaScript"><br />
<!-- Begin<br />
// Set the dates below<br />
var goLiveDate = "20011015";<br />
var expireDate = "20101015";<br />
var expireYear = expireDate.substring(0,4)<br />
var expireMonth = expireDate.slice(4,-2)<br />
var expireDay = expireDate.slice(6)<br />
var liveYear = goLiveDate.substring(0,4)<br />
var liveMonth = goLiveDate.slice(4,-2)<br />
var liveDay = goLiveDate.slice(6)<br />
var nowDate = new Date();<br />
var day = nowDate.getUTCDate();<br />
var month = nowDate.getUTCMonth();<br />
var month1 = month + 1;<br />
if (month1 < 10)<br />
{<br />
month1 = "0" + month1;<br />
}<br />
if (day < 10)<br />
{<br />
day = "0" + day;<br />
}<br />
var year = nowDate.getYear();<br />
var GMTdate = year + "" + month1 + "" + day<br />
if ((GMTdate < expireDate) && (GMTdate >= goLiveDate))<br />
{<br />
<br />
// Insert the text you want displayed below<br />
document.write("<div align='center'><b>This content appeared on " + liveMonth + "/" + liveDay + "/" + liveYear + "<br>and will disappear on " + expireMonth + "/" + expireDay + "/" + expireYear +".</b></div>")<br />
<br />
}<br />
// End --><br />
</script><!--content-->All that script will do is print the text that says what date the page went online (the first date you set) and the page it expires (the second date you set). It won't automatically remove the page once the second date is reached. Like I said before, you would need some server side language to do that.<!--content-->
 
Back
Top