I am using SharePoint 2010 and I need to place the following JavaScript code on a page to give me time in Rome
<SCRIPT LANGUAGE="JavaScript">
function GetTime() {
var dt = new Date();
var def = dt.getTimezoneOffset()/60;
var gmt = (dt.getHours() + def);
var ending = ":" + IfZero(dt.getMinutes());
var rome =check24(((gmt + 5) > 24) ? ((gmt + 5) - 24) : (gmt + 5));
document.getElementById("LocalTime2").innerHTML = (IfZero(rome) + ending);
setTimeout("GetTime()", 1000);
}
function IfZero(num) {
return ((num <= 9) ? ("0" + num) : num);
}
function check24(hour) {
return (hour >= 24) ? hour - 24 : hour;
}
// End -->
window.onload = GetTime;
</script>
<span id="LocalTime2"></span>
Currently I placed it in a CEWP and it does work, but then when I click save my drop down navigations from the menu stop working and I cant edit the page again.
Getting the following error message:
Message: 'SP.Ribbon.PageState.ImportedNativeData.PageState' is null or not an object Line: 2 Char: 79472 Code: 0 URI: http://cpts1-spointdev/_layouts/sp.ribbon.js?rev=F%2BUEJ66rbXzSvpf7nN69wQ%3D%3D
Any idea why this is happening?
Any other work-around that I can try?