Language: JavaScript
Javascript clock
// Iphone Javascript Clock var timerID = null; var timerRunning = false; function stopclock() { if (timerRunning) clearTimeout(timerID); timerRunning = false; } function showtime() { var timeValue; now = new Date(); clockHour = now.getHours(); clockMinute = now.getMinutes(); clockSecond = now.getSeconds(); if (clockHour < 12) { ampm = "AM" } else { ampm = "PM"; clockHour = clockHour - 12; } if (clockHour < 10) { clockHour = "0" + clockHour; } if (clockHour == 0) { clockHour = "12"; } if (clockMinute < 10) { clockMinute = "0" + clockMinute; } timeValue = clockHour + ":" + clockMinute + " " + ampm; $('#Clock').html(timeValue) timerID = setTimeout("showtime()", 10000); timerRunning = true; } function startclock() { stopclock(); showtime(); }
Tags:
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

