Wytchy
09-05-2003, 08:25 AM
anyone know how to go about making an expiration date for my web site? i wish it to expire after 30 day's if i don't remove the code.
thanks
Wytchy
thanks
Wytchy
|
Click to See Complete Forum and Search --> : Expiration Script Wytchy 09-05-2003, 08:25 AM anyone know how to go about making an expiration date for my web site? i wish it to expire after 30 day's if i don't remove the code. thanks Wytchy Mr J 09-06-2003, 08:04 AM You could possibly do it by redirecting. When the date entered is reached you redirect to another page. The page containing the script should be replace your index page with your original index page renamed and this name entered in the script ie: homepage.htm The script then redirects to this page unless the time limit is up then it will redirect to another page. ie: downpage.htm <script> <!-- var y=2003 // enter year var m=09 // enter month var d=01 // enter date var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") function countfrom(yr,m,d){ var today=new Date() var todayy=today.getYear() if (todayy < 1000) todayy+=1900 var todaym=today.getMonth() var todayd=today.getDate() var todaystring=montharray[todaym]+" "+todayd+", "+todayy var paststring=montharray[m-1]+" "+d+", "+yr var difference=(Math.round((Date.parse(todaystring)-Date.parse(paststring))/(24*60*60*1000))*1) if(difference>=30){ location="downpage.htm" } else{ location="homepage.htm" } } function run_me(){ countfrom(y,m,d) } // add onload="run_me()" to the opening BODY tag // --> </script> Add onload="run_me()" to the opening BODY tag Wytchy 09-06-2003, 08:15 AM Great thanks a lot I really appreciate it. Wytchy brendandonhue 09-06-2003, 08:23 AM Don't count on perfect results doing this with javascript. 13% of your users will still see your site after its expired because they don't have javascript. And any other user of your site could disable Javascript and view the content after its expired. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |