Не получается:
<script type="text/javascript">
var tutu;
function getTime(zone, success)
{
var url = 'http://json-time.appspot.com/time.json?tz=' + zone,
ud = 'json' + (+new Date());
window[ud]= function(o){
success && success(new Date(o.datetime));
};
document.getElementsByTagName('head')[0].appendChild((function()
{
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = url + '&callback=' + ud;
return s;
})());
}
getTime('GMT', function(time){
tutu = time.getHours();
})
</script>
</head>
<body>
<script type="text/javascript">alert(tutu);</script>
</body>
Это возвращает "undefined".
|