I need开发者_StackOverflow to add the current running time into the default.master page. The time should auto-update. I don't have access to add code except for javascript.
Its not really sharepoint question. You need a Jquery/javascript solution here. The following script will show the time on the web page. You need to reexecute it as per your interval to refresh it if you want.
1: <script language="javascript">
2: function getTime() {
3: var dTime = new Date();
4: var hours = dTime.getHours();
5: var minute = dTime.getMinutes();
6: var period = "AM";
7: if (hours > 12) {
8: period = "PM"
9: }
10: else {
11: period = "AM";
12: }
13: hours = ((hours > 12) ? hours - 12 : hours)
14: return hours + ":" + minute + " " + period
15: }
16: </script>
精彩评论