jQuery时间插件jquery.clock.js用法实例(5个示例)

Basic clock, no options

<html> <head> <title>jclock</title> <mce:script type="text/javascript" src="https://www.jb51.net/jquery-1.2.1.min.js" mce_src="https://www.jb51.net/jquery-1.2.1.min.js"></mce:script> <mce:script type="text/javascript" src="https://www.jb51.net/jquery.jclock.js" mce_src="https://www.jb51.net/jquery.jclock.js"></mce:script> <mce:script type="text/javascript"><!-- $(function($) { $('.jclock').jclock(); }); // --></mce:script> </head> <body> <div></div> </body> </html>

Example 2:

Clock, non-UTC, with options

<html> <head> <title>jclock</title> <mce:script type="text/javascript" src="https://www.jb51.net/jquery-1.2.1.min.js" mce_src="https://www.jb51.net/jquery-1.2.1.min.js"></mce:script> <mce:script type="text/javascript" src="https://www.jb51.net/jquery.jclock.js" mce_src="https://www.jb51.net/jquery.jclock.js"></mce:script> <mce:script type="text/javascript"><!-- $(function($) { var options = { timeNotation: '12h', am_pm: true, fontFamily: 'Verdana, Times New Roman', fontSize: '20px', foreground: 'yellow', background: 'red' } $('.jclock').jclock(options); }); // --></mce:script> </head> <body> <div></div> </body>

Example 3:

Clock, UTC

<html> <head> <title>jclock <mce:script type="text/javascript" src="https://www.jb51.net/jquery-1.2.1.min.js" mce_src="https://www.jb51.net/jquery-1.2.1.min.js"></mce:script> <mce:script type="text/javascript" src="https://www.jb51.net/jquery.jclock.js" mce_src="https://www.jb51.net/jquery.jclock.js"></mce:script> <mce:script type="text/javascript"><!-- $(function($) { var options = { utc: true } $('.jclock').jclock(options); }); // --></mce:script> </title></head> <body> <div></div> </body> </html>

Example 4:

Multiple clocks using different time zone offsets

<html> <head> <title>jclock</title> <mce:script type="text/javascript" src="https://www.jb51.net/jquery-1.2.1.min.js" mce_src="https://www.jb51.net/jquery-1.2.1.min.js"></mce:script> <mce:script type="text/javascript" src="https://www.jb51.net/jquery.jclock.js" mce_src="https://www.jb51.net/jquery.jclock.js"></mce:script> <mce:script type="text/javascript"><!-- $(function($) { var optionsEST = { utc: true, utc_offset: -5 } $('#jclock1').jclock(optionsEST); var optionsCST = { utc: true, utc_offset: -6 } $('#jclock2').jclock(optionsCST); var optionsIndia = { utc: true, utc_offset: 5.5 } $('#jclock3').jclock(optionsIndia); }); // --></mce:script> </head> <body> <p>EST: <span></span></p> <p>CST: <span></span></p> <p>India: <span></span></p> </body> </html>

Example 5:

Styled clocks (first clock uses jquery.corner.js)

<html> <head> <title>jclock</title> <mce:style type="text/css"><!-- body { font: Verdana,Arial,sans-serif; /* An explicit background color is required for Safari. */ /* Otherwise your corner chunks will come out black! */ background: #f8f0e0; } div.corner, div.nocorner { width: 10em; padding: 20px; margin: 1em; background: #f00; color: #000; text-align: center; font: verdana, arial, sans-serif; } --></mce:style><style type="text/css" mce_bogus="1"> body { font: Verdana,Arial,sans-serif; /* An explicit background color is required for Safari. */ /* Otherwise your corner chunks will come out black! */ background: #f8f0e0; } div.corner, div.nocorner { width: 10em; padding: 20px; margin: 1em; background: #f00; color: #000; text-align: center; font: verdana, arial, sans-serif; } </style> <mce:script type="text/javascript" src="https://www.jb51.net/jquery-1.2.1.min.js" mce_src="https://www.jb51.net/jquery-1.2.1.min.js"></mce:script> <mce:script type="text/javascript" src="https://www.jb51.net/jquery.jclock.js" mce_src="https://www.jb51.net/jquery.jclock.js"></mce:script> <mce:script type="text/javascript" src="https://www.jb51.net/jquery.corner.js" mce_src="https://www.jb51.net/jquery.corner.js"></mce:script> <mce:script type="text/javascript"><!-- $(function($) { var options = { timeNotation: '12h', am_pm: true, fontFamily: 'Verdana, Times New Roman', fontSize: '20px', foreground: 'yellow', background: 'red' } $('.jclock').jclock(options); $('.corner').corner("30px"); }); // --></mce:script> </head> <body> <p><div><div></div></div></p> <p><div><div></div></div></p> </body> </html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgwdsy.html