<html>
<head>
<title>VISIT COUNTER</title>
<style>
.counter{
background-color:white;
color:blue;
font-weight:bold;}
</style>
<SCRIPT>
expireDate = new Date
expireDate.setMonth(expireDate.getMonth()+6)
jcount = eval(cookieVal("jaafarCounter"))
jcount++
document.cookie = "jaafarCounter="+jcount+";expires=" + expireDate.toGMTString()
function cookieVal(cookieName) {
thisCookie = document.cookie.split("; ")
for (i=0; i<thisCookie.length; i++){
if (cookieName == thisCookie[i].split("=")[0]){
return thisCookie[i].split("=")[1]
}
}
return 0
}
function page_counter(){
for (i=0;i<(7-jcount.toString().length);i++)
document.write('<span class="counter">0</span>')
for (y=0;y<(jcount.toString().length);y++)
document.write('<span class="counter">'+jcount.toString().charAt(y)+'</span>')
}
</SCRIPT>
<SCRIPT>
page_counter(jcount);
</SCRIPT>
</head>
</html>
Here you can find a number of examples on Java Script.Please find the various kinds of examples listed on the right side of this site. If you don't find anything on Java Script then please write to us or leave a commnet. We are pleased to help and find the solution of your problem.
Showing posts with label date object. Show all posts
Showing posts with label date object. Show all posts
JavaScript: Date Function
<html>
<head>
<title>Date Function</title>
<script language="javascript">
var cdate=new Date();
function day()
{
var d1=cdate.getDay();
if(d1==0)
d1="Sunday";
else if(d1==1)
d1="Monday";
else if(d1==2)
d1="Tuesday";
else if(d1==3)
d1="Wednesday";
else if(d1==4)
d1="Thursday";
else if(d1==5)
d1="Friday";
else if(d1==6)
d1="Saturday";
time.d.value=d1;
}
function month()
{
time.m.value=cdate.getMonth()+1;
}
function year()
{
var cyear=cdate.getYear();
time.y.value=cyear;
}
function hour()
{
time.h.value=cdate.getHours();
}
function minute()
{
time.m1.value=cdate.getMinutes();
}
function sec()
{
time.s1.value=cdate.getSeconds();
}
function time1()
{
time.t.value=cdate.getTime();
}
function date()
{
time.d1.value=cdate;
}
</script>
</head>
<body>
<form name="time">
<input type="button" value="Day" onclick="day()">
<input type="text" name="d">
<input type="button" value="Month" onclick="month()">
<input type="text" name="m">
<input type="button" value="Year" onclick="year()">
<input type="text" name="y">
<input type="button" value="Hour" onclick="hour()">
<input type="text" name="h">
<input type="button" value="Minute" onclick="minute()">
<input type="text" name="m1">
<input type="button" value="Second" onclick="sec()">
<input type="text" name="s1">
<input type="button" value="Time" onclick="time1()">
<input type="text" name="t">
<input type="button" value="Date" onclick="date()">
<input type="text" name="d1">
</form>
</body>
</html>
<head>
<title>Date Function</title>
<script language="javascript">
var cdate=new Date();
function day()
{
var d1=cdate.getDay();
if(d1==0)
d1="Sunday";
else if(d1==1)
d1="Monday";
else if(d1==2)
d1="Tuesday";
else if(d1==3)
d1="Wednesday";
else if(d1==4)
d1="Thursday";
else if(d1==5)
d1="Friday";
else if(d1==6)
d1="Saturday";
time.d.value=d1;
}
function month()
{
time.m.value=cdate.getMonth()+1;
}
function year()
{
var cyear=cdate.getYear();
time.y.value=cyear;
}
function hour()
{
time.h.value=cdate.getHours();
}
function minute()
{
time.m1.value=cdate.getMinutes();
}
function sec()
{
time.s1.value=cdate.getSeconds();
}
function time1()
{
time.t.value=cdate.getTime();
}
function date()
{
time.d1.value=cdate;
}
</script>
</head>
<body>
<form name="time">
<input type="button" value="Day" onclick="day()">
<input type="text" name="d">
<input type="button" value="Month" onclick="month()">
<input type="text" name="m">
<input type="button" value="Year" onclick="year()">
<input type="text" name="y">
<input type="button" value="Hour" onclick="hour()">
<input type="text" name="h">
<input type="button" value="Minute" onclick="minute()">
<input type="text" name="m1">
<input type="button" value="Second" onclick="sec()">
<input type="text" name="s1">
<input type="button" value="Time" onclick="time1()">
<input type="text" name="t">
<input type="button" value="Date" onclick="date()">
<input type="text" name="d1">
</form>
</body>
</html>
Labels:
calculate,
calculate date,
calculate time,
date,
date function,
date object,
dateobject,
day,
hour,
hours,
javascript,
minute,
minutes,
month,
second,
time,
time object,
year
Subscribe to:
Posts (Atom)