你可以做一些丑陋的事情显然你可以在一个循环或其他东西中做到这一点,所以你不必像我在这里所做的那样编写你的代码 3 次
另外 - jclock 文档中的示例很少:https ://sites.google.com/site/jqueryjclockjs/
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="http://techtricky.com/wp-content/jquery/jquery.jclock.js"></script>
<script type="text/javascript">
$(document).ready(
function() {
$('#time-cont1').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: 8
}
$('#time-cont1 .time').jclock(options);
$('#time-cont2').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: 6
}
$('#time-cont2 .time').jclock(options);
$('#time-cont3').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: -5
}
$('#time-cont3 .time').jclock(options);
});
</script>
</head>
<body>
Country1: <div id="time-cont1"></div>
Country2: <div id="time-cont2"></div>
Country3: <div id="time-cont3"></div>
</body>
</html>