Simple code explanation- Beginner Question
Hello,
New to jQuery. I am
really on a deadline, hence seeking help from the forum.
I need help understanding this piece of code which basically retrieves the time and date.
So if anybody could explain it to me
elaborately, that'd be awesome. Ultimately, my aim is to send to processingjs. To be precise, i need to send the user's selection as well as the result of that selection. Where is the retrieved date, time etc stored exactly?
Here's the
example. and the code-
-
| <script type="text/javascript"> |
|
$(document).ready( |
|
function() { |
|
//$('#time').jclock(); |
|
$("#zones").change(function(){ |
|
if ($('#time-cont .time').length>0){ $('#time-cont .time').remove();} |
|
var offset = $(this).val(); |
|
if (offset == '') return; |
|
|
|
$('#time-cont').append('<div class="time"></div>'); |
|
|
|
var options = { |
|
format:'<span class=\"dt\">%A, %d %B %I:%M:%S %P</span>', |
|
timeNotation: '12h', |
|
am_pm: true, |
|
fontFamily: 'Verdana, Times New Roman', |
|
fontSize: '20px', |
|
foreground: 'black', |
|
background: 'yellow', |
|
utc:true, |
|
utc_offset: offset |
|
} |
|
|
|
$('#time-cont .time').jclock(options); |
|
|
|
}); |
|
}); |
|
</script> |
|
|
|
</head> |
|
<body> |
|
<div style="margin-bottom:10px"><a href="http://www.techtricky.com/jquery-code-to-show-time-in-different-countries/"><< Go back to the site</a></div> |
|
<select id="zones"> |
|
<option value="">--Select--</option> |
|
<option value="10">Australia</option> |
|
<option value="-3">Brazil</option> |
|
<option value="-5">Canada</option> |
|
<option value="8">China</option> |
|
<option value="1">Germany</option> |
|
<option value="5.5">India</option> |
|
<option value="9">Japan</option> |
|
<option value="8">Malaysia</option> |
|
<option value="12">Newzealand</option> |
|
<option value="0">UK</option> |
|
<option value="-5">US EST</option> |
|
|
|
</select> |
|
<div id="time-cont"></div> |