I've got the code set up, but it isn't working. here's the code:
- Code: Select all
function Clockf()
{
var t=new Date();
var clock=toStandard(t.getHours()) + ":" + fillSpace(t.getMinutes()) + ":" + fillSpace(t.getSeconds()) + var mer;
setTimeout("Clock()",1000);
document.getElementById("clock").innerHTML=clock;
}
function fillSpace(value)
{
return(value>9) ? "" + value : "0" + value;
}
function toStandard(value)
{
return(value>9) ? "" + value : "0" + value;
if(value==0) { value+12; mer="AM" } else if(value<12) { mer="AM" } else { value-12; mer="PM"; }
}
and the page accessing it (as a test page):
- Code: Select all
<html>
<head><script src="behaviors/clock.js"></script>
</head>
<body onLoad="Clockf()">
<script src="behaviors/greeting.js"></script>
<div id="clock"></div>
</body>
</html>
The other script in here loads properly, but the clock part never shows up. Anyone know what I'm doing wrong, or how I could fix it?
I originally had the last JS function as:
- Code: Select all
function toStandard(value)
{
return(value>9) ? "" + value : "0" + value;
return(value==0) ? value+12 && mer="AM" : (value<12) ? mer="AM" : value-12 && mer="PM";
}


