日期:2014-05-16 浏览次数:20382 次
var task = { run: function(){ Ext.fly('clock').update(new Date().format('g:i:s A')); }, interval: 1000 //1 second } Ext.TaskManager.start(task);
<%@ page language="java" contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 2.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml2.dtd"> <html> <head> <script type="text/javascript" src="ext4/ext-all.js"></script> <link rel="stylesheet" type="text/css" href="ext4/resources/css/ext-all.css"/> <script type="text/javascript"> Ext.onReady(function(){ var task = { run: function(){ Ext.fly('clock').update(new Date().format('g:i:s A')); }, interval: 1000 //1 second } Ext.TaskManager.start(task); }); </script> </head> <body> <div id="clock"></div> </body> </html>
Ext.fly('clock').update(new Date());
------解决方案--------------------
.format('g:i:s A') 这个的问题把它去了
------解决方案--------------------
改成这样
Ext.onReady(function () { var task = { run: function () { Ext.fly('clock').update(Ext.Date.format(new Date(), 'g:i:s A')); }, interval: 1000 //1 second } Ext.TaskManager.start(task); });