Javascript Essentials Part 1

Website Launched Since – Javascript Code

<script language="javascript">
montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
function countup(yr,m,d){
today=new Date()
todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
todaym=today.getMonth()
todayd=today.getDate()
todaystring=montharray[todaym]+" "+todayd+", "+todayy
paststring=montharray[m-1]+" "+d+", "+yr
difference=(Math.round((Date.parse(todaystring)-Date.parse(paststring))/(24*60*60*1000))*1)
difference+=" days"
document.write("It has been "+difference+" since the launch of website name")
}
//enter the count up date using the format year/month/day
countup(2005,09,07)
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *