im new to java script. I am trying to make a time/date function update automatically. when i view the page i get the right time, but i have to refresh the browser in order to update it. How can i do it to automatically update itself.
i want the clients time not the servers time.
<script language="JavaScript" type="text/javascript">
var d=new Date();
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var hours = d.getHours();
var minutes = d.getMinutes();
var sec = d.getSeconds();
var suffix = "AM"
if (hours >= 12)
{
suffix = "PM"
hours = hours - 12;
}
if (minutes < 10)
minutes = "0" = minutes
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear() + " " + hours + ":" + minutes + ":" + sec + suffix
</script>
</head>
<body>
<script language="JavaScript" type="text/javascript">
document.write(TODAY); </script>
</body>
</html>