//Gets the browser specific XmlHttpRequest Object function getXmlHttpRequestObject() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if(window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your Browser Sucks!\nIt's about time to upgrade don't you think?"); } } function createAjaxObj(){ var httprequest=false if (window.XMLHttpRequest) { // if Mozilla, Safari etc httprequest=new XMLHttpRequest() if (httprequest.overrideMimeType) httprequest.overrideMimeType('text/xml') } else if (window.ActiveXObject) { // if IE try { httprequest=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ try{ httprequest=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){} } }else { alert("Your Browser don't support ajax"); } return httprequest } //Our XmlHttpRequest object to get the auto suggest var searchReq = createAjaxObj();
//Called from keyup on the search textbox. //Starts the AJAX request. function doRequestUsingGET(url,handleStateChange) { if (searchReq.readyState == 4 || searchReq.readyState == 0) { searchReq.open("GET", url, true); searchReq.onreadystatechange = handleStateChange; searchReq.send(null); } }
function updateNumber(obj) { var url = "HistoryNumberServlet?id="+obj.tid+"&actualAmount="+obj.value+"&operator=amount"; doRequestUsingGET(url,handleDefault); priceTotal(); }
function openWin(f,n,w,h,s){ sb = s == "1" ? "1" : "0"; l = (screen.width - w)/2; t = (screen.height - h)/2; sFeatures = "left="+ l +",top="+ t +",height="+ h +",width="+ w + ",center=0,scrollbars=" + sb + ",status=0,directories=0,channelmode=0"; openwin = window.open(f , n , sFeatures ); /* if (!openwin.opener) openwin.opener = self; openwin.focus(); */ return openwin; }
function chkDel(){ var flag = false; for (var i = 0; i < document.getElementsByName("chkDelete").length; i++) { if (document.getElementsByName("chkDelete")[i].checked) { flag = true; } } if (!flag) { alert("请选择需要删除的报纸!"); return; } if(confirm("确定要删除?")){ with(document.getElementById("form1")){ method = "post"; action = "pager.do?command=del"; submit(); } } }