Faeroph
11-09-2002, 05:03 PM
hey all..below is a script from my avidgamers homepage..i've tried to implement a countup script from the JSkit site, but with little success. when i place the script where i want it to be, i get 'NaN' instead of the number of days. EDIT: I have found out why it doesnt work - the page gets deletes the ' [todaym] ' after montharray every time i upload. i put it in the html and it isnt there when i view source. i'm even more stuck than i was before, as now i have to find some way of editing the source and saving the changes, which i dont think is possible on an avid page. sigh.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head><title>Acting Knights - Public area</title>
<style type="text/css">
body { font-family: comic sans; font-size: 14pt; color: blue; margin: 0px;}
form { margin: 2px;}
.head { font-family: comic sans; font-size: 16pt; color: white; background-color: #006448;}
.one { font-family: comic sans; font-size: 12pt; color: white; background-color: #BBBBBB;}
.two { font-family: comic sans; font-size: 12pt; color: white; background-color: #CCCCCC;}
.onesmall { font-family: comic sans; font-size: 12pt; color: white; background-color: #BBBBBB;}
.twosmall { font-family: comic sans; font-size: 12pt; color: white; background-color: #CCCCCC;}
th { font-weight: bold; font-family: comic sans; font-size: 14pt; color: blue;}
select { font-size: 12pt;}
td { font-family: comic sans; font-size: 14pt; color: blue;}
select { font-size: 12pt;}
h1 { font-size: 14pt; font-weight: normal; margin-top: 2px; margin-bottom: 2px;}
h2 { font-size: 12pt; font-weight: normal; margin-top: 2px; margin-bottom: 2px;}
h3 { font-size: 12pt; font-weight: normal; margin-top: 2px; margin-bottom: 2px;}
small { font-size: 12pt; }
A:link, A:visited { color: red; text-decoration: underline;}
A:active, A:hover { color: white; text-decoration: none;}
.visit:visited { color: white; text-decoration: underline;}
</style>
</head>
<body bgcolor="black" text="blue" link="red" alink="white">
<div align="center">
<small>[<a href="members.php" target="_top">to private area</a>]</small>
<h1><a href="index.php?main">Acting Knights</a></h1>
<h3>- Public area -</h3>
<script>
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
function countup(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)
difference+=" days"
document.write("It\'s been "+difference+" since the launch of JavaScript Kit!")
}
//enter the count up date using the format year/month/day
countup(1997,12,05)
</script>
<p align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript
Kit</a></font></p>
<p>
the rest of the page code is not shown, as i have tested it without and it makes no difference.
i have also tested the script (on its own) on frontpage, and it works fine.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head><title>Acting Knights - Public area</title>
<style type="text/css">
body { font-family: comic sans; font-size: 14pt; color: blue; margin: 0px;}
form { margin: 2px;}
.head { font-family: comic sans; font-size: 16pt; color: white; background-color: #006448;}
.one { font-family: comic sans; font-size: 12pt; color: white; background-color: #BBBBBB;}
.two { font-family: comic sans; font-size: 12pt; color: white; background-color: #CCCCCC;}
.onesmall { font-family: comic sans; font-size: 12pt; color: white; background-color: #BBBBBB;}
.twosmall { font-family: comic sans; font-size: 12pt; color: white; background-color: #CCCCCC;}
th { font-weight: bold; font-family: comic sans; font-size: 14pt; color: blue;}
select { font-size: 12pt;}
td { font-family: comic sans; font-size: 14pt; color: blue;}
select { font-size: 12pt;}
h1 { font-size: 14pt; font-weight: normal; margin-top: 2px; margin-bottom: 2px;}
h2 { font-size: 12pt; font-weight: normal; margin-top: 2px; margin-bottom: 2px;}
h3 { font-size: 12pt; font-weight: normal; margin-top: 2px; margin-bottom: 2px;}
small { font-size: 12pt; }
A:link, A:visited { color: red; text-decoration: underline;}
A:active, A:hover { color: white; text-decoration: none;}
.visit:visited { color: white; text-decoration: underline;}
</style>
</head>
<body bgcolor="black" text="blue" link="red" alink="white">
<div align="center">
<small>[<a href="members.php" target="_top">to private area</a>]</small>
<h1><a href="index.php?main">Acting Knights</a></h1>
<h3>- Public area -</h3>
<script>
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
function countup(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)
difference+=" days"
document.write("It\'s been "+difference+" since the launch of JavaScript Kit!")
}
//enter the count up date using the format year/month/day
countup(1997,12,05)
</script>
<p align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript
Kit</a></font></p>
<p>
the rest of the page code is not shown, as i have tested it without and it makes no difference.
i have also tested the script (on its own) on frontpage, and it works fine.