var id = ""; var cid = ""; var tid = ""; Ext.onReady(function () { id = UrlParm.parm("id"); cid = UrlParm.parm("cid"); tid = UrlParm.parm("tid"); fnGetList(); setInterval(function () { document.getElementById("listUL").innerHTML = ""; fnGetList(); }, 120000) //每1000毫秒(即1秒) 执行一次本段代码 }); function fnGetList() { var _store = Ext.create('DsExt.ux.RefTableStore', { fields: [ { name: 'GID', type: 'string' }, { name: 'TITLE', type: 'string' }, { name: 'URL', type: 'string' }, { name: 'CONTENT', type: 'string' } ], proxy: { url: '/MvcShipping/MsTemplet/GetLayShowList' }, scope: this }); _store.load({ params: { id: id, companyid: cid, templetid: tid} }); var newElement; _store.on("load", function (_store) { for (var i = 0; i < _store.getCount(); i++) { if (i == 0) { document.getElementById("msgTitle").innerHTML = "" + _store.getAt(i).get("TITLE") + ""; document.getElementById("msgContent").innerHTML = "" + _store.getAt(i).get("CONTENT") + ""; } else { newElement = document.createElement("li"); newElement.setAttribute("class", "listLI"); newElement.innerHTML = "" + _store.getAt(i).get("TITLE") + ""; document.getElementById("listUL").appendChild(newElement); } } }); }