PDA

View Full Version : Resolved Clock



timmiejboi
Mar 2nd, 2014, 12:18 PM
Hello guys,
This is the javascript clock of my website
But he load very slow.
and in internet explore he gives error
the content is blocked
Someone can help me out please


<style type="text/css">
#clock { font-size:1.1em; color:black; }
</style>

<script type="text/javascript">
function updateClock (){
var currentTime = new Date ( );

//Get the hours for updating clock
var currentHours = currentTime.getHours ();

//Get the minutes for updating clock
var currentMinutes = currentTime.getMinutes ();

//Get the minutes for updating clock
var currentSeconds = currentTime.getSeconds();

// Pad the minutes and seconds with leading zeros, if required
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;

// Choose either "AM" or "PM" as appropriate
var timeOfDay = ''; // ( currentHours < 12 ) ? "AM" : "PM";

// Convert the hours component to 12-hour format if needed
// currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;

// Convert an hours component of "0" to "12"
// currentHours = ( currentHours == 0 ) ? 12 : currentHours;

// Compose the string for display
var currentTimeString = currentHours + ":" + currentMinutes + ':' + currentSeconds+ " " + timeOfDay;

// Update the time display
document.getElementById("clock").innerHTML = currentTimeString;
}
</script>
</head>

<body onLoad="updateClock(); setInterval('updateClock()', 1000 )">
<span id="clock">&nbsp;</span>
</body>

Philip M
Mar 2nd, 2014, 12:30 PM
Hello guys,
This is the javascript clock of my website
But he load very slow.
and in internet explore he gives error
the content is blocked
Someone can help me out please



It works fine for me in IE10 with no errors, also in Chome. Why have you marked this thread as "Resolved"? Does that mean that you no longer wish to ask this question?


My opinion of that shot is unprintable on air. - Commentator BBC 4.

timmiejboi
Mar 2nd, 2014, 12:45 PM
Philp m,

No sorry , i think i use the wrong button for resolved :|

But i use internet explore 10 to but i get the content error.

i thought maybe i need to optimize this script , or update?

Philip M
Mar 2nd, 2014, 12:51 PM
Philp m,

No sorry , i think i use the wrong button for resolved :|

But i use internet explore 10 to but i get the content error.

i thought maybe i need to optimize this script , or update?

As I say, it works fine for me in IE10. There is nothing wrong with the code. You can easily test it as a free-standing script. Look elsewhere for your problem.