function checkUpdateTime(){ var id=$news.ID; var updateTime=1356085080330; var updateTimeNews=0; var nowTime=1754235061821; if((updateTimeNews>updateTime||nowTime-updateTime>12*60*1000)&&top.location==self.location){ if(typeof(_SESSION)=='undefined'){ window.location.href="/news/view.jsp?action=update&id="+id; return; } /* var iframe=document.createElement("iframe"); iframe.height=0; iframe.width=0; iframe.src="/news/view.jsp?action=update&id="+id; document.body.appendChild(iframe); */ var url="/news/view.jsp"; var ajax=new Ajax(); var vars="action=update&id="+id; ajax.connect(url, 'POST', vars, function(xmlhttp){document.title+='[页面已更新!]'}); } } checkUpdateTime(); /* if(window.attachEvent){ window.attachEvent("onload",function(){checkUpdateTime();}); }else if(window.addEventListener){ window.addEventListener("load",function(){checkUpdateTime();},false); } */ function Ajax(){ var xmlhttp, bComplete = false; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; }}} if (!xmlhttp) return null; this.connect = function(sURL, sMethod, sVars, fnDone){ if (!xmlhttp) return false; bComplete = false; sMethod = sMethod.toUpperCase(); try { if (sMethod == "GET"){ xmlhttp.open(sMethod, sURL+"?"+sVars, true); try{ xmlhttp.overrideMimeType("text/html;charset=gb2312");//设定以gb2312编码识别数据 }catch(e){} sVars = ""; }else{ xmlhttp.open(sMethod, sURL, true); try{ xmlhttp.overrideMimeType("text/html;charset=gb2312");//设定以gb2312编码识别数据 }catch(e){} xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1"); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); } xmlhttp.onreadystatechange = function(){ if (xmlhttp.readyState == 4 && !bComplete){ bComplete = true; fnDone(xmlhttp); }}; xmlhttp.send(sVars); } catch(z) { return false; } return true; }; return this; }