Hi friends, today’s I want to share a JavaScript’s program. Actually few days ago I started reading JavaScript’s. I found that JavaScript’s is very essential for web programming. JavaScript’s add dynamic things to a program.
Here I give a JavaScript’s code using date object. I use some build in JavaScript’s function. Here I created a clock using JavaScript’s. Here the code for a digital clock. You can use the clock in your website. The code is very simple to understand. The clock gives you hours, minutes, seconds and A.M and P.M. So guys lets check it out.

<HEAD>
<script type=”text/javascript”>

<!–
function startclock()
{
var time=new Date();var hours=time.getHours();
var mins=time.getMinutes();
var sec=time.getSeconds();
var AandP=” “;

if (hours>=12)
AandP=”P.M.”;
else
AandP=”A.M.”;

if (hours>=13)
hours-=12;

if (hours==0)
hours=12;

if (sec<10)
sec=”0″+sec;

if (mins<10)
mins=”0″+mins;

document.clock.clockspot.value=hours+”:”+mins+”:”+sec+” “+AandP;

setTimeout(’startclock()’,1000);

} //–>
</script>
</HEAD>

<BODY onLoad=”startclock()”>
<FORM name=”clock”>
Current Time: <INPUT TYPE=”text” name=”clockspot”>
</FORM>
</BODY>

To run this code just copy the code and paste it.  Open to your browser. And enjoy JavaScript’s.