Heres the final result. I'm updating it so that in the future, questions like the one I originally posted (how to make a 12 hour clock) can be forwarded to this thread for reference. Thanks to MrChief for his help!
<html>
<head>
<script type="text/javascript">
String.prototype.lpad = function(padString, length) {
var str = this;
while (str.length < length) {
str = padString + str;
}
return str;
}
function timeNow() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
var tt = (h >= 12) ? " pm" : " am";
time = (h - 12).toString().lpad("0", 2) + ":" + m.toString().lpad("0", 2) + ":" + s.toString().lpad("0", 2) + tt;
document.getElementById('txt').innerHTML=time;
var timer = setTimeout(timeNow,500);
}
</script></head>
<body onload="timeNow()">
<div id="txt"></div>
</body></html>