var nowpage = 1; function getValue(name) { var URLParams = new Array(); var aParams = document.location.search.substr(1).split('&'); for (i = 0; i < aParams.length; i++) { var aParam = aParams[i].split("="); URLParams[aParam[0]] = aParam[1]; } if (URLParams[name]) { return URLParams[name].replace("#", ""); } else { return ""; } } function GetXmlHttpObject() { var xmlHttp = null; try { // Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } function ShowData(DataPlace, ColumnId, DataCounts, DataType) { var xmlHttp = GetXmlHttpObject(); if (xmlHttp == null) { alert("您的浏览器不支持AJAX!"); return; } xmlHttp.open("GET", ServerUrl + "TabletopData.aspx?DataType=" + DataType + "&WebsiteId=" + WebsiteId + "&ColumnId=" + ColumnId + "&DataCounts=" + DataCounts + "&" + Math.random(), true); xmlHttp.onreadystatechange = function () { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { document.getElementById(DataPlace).innerHTML = xmlHttp.responseText; } } } xmlHttp.send(null); } function ShowColumn(DataPlace, bigclass) { var xmlHttp = GetXmlHttpObject(); if (xmlHttp == null) { alert("您的浏览器不支持AJAX!"); return; } xmlHttp.open("GET", ServerUrl + "Column.aspx?bigclass=" + bigclass + "&" + Math.random(), true); xmlHttp.onreadystatechange = function () { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { document.getElementById(DataPlace).innerHTML = xmlHttp.responseText; } } } xmlHttp.send(null); } function ShowBigclass(DataPlace, bigclass) { var xmlHttp = GetXmlHttpObject(); if (xmlHttp == null) { alert("您的浏览器不支持AJAX!"); return; } xmlHttp.open("GET", ServerUrl + "BigClass.aspx?bigclass=" + bigclass + "&" + Math.random(), true); xmlHttp.onreadystatechange = function () { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { document.getElementById(DataPlace).innerHTML = xmlHttp.responseText; if (xmlHttp.responseText != "") { document.getElementById("address").innerHTML = "> " + xmlHttp.responseText; } } } } xmlHttp.send(null); } function ShowSmallclass(bigclass, smallclass) { var xmlHttp = GetXmlHttpObject(); if (xmlHttp == null) { alert("您的浏览器不支持AJAX!"); return; } xmlHttp.open("GET", ServerUrl + "SmallClass.aspx?bigclass=" + bigclass + "&smallclass=" + smallclass + "&" + Math.random(), true); xmlHttp.onreadystatechange = function () { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { if (xmlHttp.responseText!=""){ document.getElementById("address").innerHTML = document.getElementById("address").innerHTML + " > " + xmlHttp.responseText; } } } } xmlHttp.send(null); } function ShowList(DataPlace, bigclass, smallclass, page) { var xmlHttp = GetXmlHttpObject(); if (xmlHttp == null) { alert("您的浏览器不支持AJAX!"); return; } document.getElementById("loading").style.display = ""; xmlHttp.open("GET", ServerUrl + "DataList.aspx?bigclass=" + bigclass + "&smallclass=" + smallclass + "&page=" + page + "&" + Math.random(), true); xmlHttp.onreadystatechange = function () { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { var str = xmlHttp.responseText; if (str.indexOf("外部链接||") != -1) { window.open(xmlHttp.responseText.replace("外部链接||", ""), "_blank", ""); } else { document.getElementById(DataPlace).innerHTML = xmlHttp.responseText; } } } } xmlHttp.send(null); document.getElementById("loading").style.display = "none"; } function firstpage() { if (document.getElementById("NowPage").innerHTML == "1") { alert("目前已经是首页!"); } else { ShowList('div3', getValue("bigclass"), getValue("smallclass"), 1); nowpage = 1; } } function pritpage() { if (document.getElementById("NowPage").innerHTML == "1") { alert("目前已经是首页!"); } else { ShowList('div3', getValue("bigclass"), getValue("smallclass"), nowpage - 1); nowpage = nowpage - 1; } } function nextpage() { if (document.getElementById("PageCount").innerHTML == nowpage) { alert("目前已经是尾页!"); } else { ShowList('div3', getValue("bigclass"), getValue("smallclass"), nowpage + 1); nowpage = nowpage + 1; } } function lasttpage() { if (document.getElementById("PageCount").innerHTML == nowpage) { alert("目前已经是尾页!"); } else { ShowList('div3', getValue("bigclass"), getValue("smallclass"), document.getElementById("PageCount").innerHTML); nowpage = document.getElementById("PageCount").innerHTML; } } function changepage(page) { if (nowpage == 1 && page == "1") { alert("目前已经是首页!"); } else if (nowpage == document.getElementById("PageCount").innerHTML && page == document.getElementById("PageCount").innerHTML) { alert("目前已经是尾页!"); } else { ShowList('div3', getValue("bigclass"), getValue("smallclass"), page); nowpage = page; } } function firstpageSearch() { if (document.getElementById("NowPage").innerHTML == "1") { alert("目前已经是首页!"); } else { search("1"); nowpage = 1; } } function pritpageSearch() { if (document.getElementById("NowPage").innerHTML == "1") { alert("目前已经是首页!"); } else { nowpage = nowpage - 1; search(nowpage); } } function nextpageSearch() { if (document.getElementById("PageCount").innerHTML == nowpage) { alert("目前已经是尾页!"); } else { nowpage = parseInt(nowpage) + 1; search(nowpage); } } function lasttpageSearch() { if (document.getElementById("PageCount").innerHTML == nowpage) { alert("目前已经是尾页!"); } else { search(document.getElementById("PageCount").innerHTML); nowpage = document.getElementById("PageCount").innerHTML; } } function changepageSearch(page) { if (nowpage == 1 && page == "1") { alert("目前已经是首页!"); } else if (nowpage == document.getElementById("PageCount").innerHTML && page == document.getElementById("PageCount").innerHTML) { alert("目前已经是尾页!"); } else { search(page); nowpage = page; } } function search(page) { if (document.getElementById("keyword").value == "") { alert("请输入关键字!"); } else { var xmlHttp = GetXmlHttpObject(); if (xmlHttp == null) { alert("您的浏览器不支持AJAX!"); return; } document.getElementById("loading").style.display = ""; xmlHttp.open("GET", ServerUrl + "DataSearch.aspx?&WebsiteId=" + WebsiteId + "&keyword=" + encodeURI(document.getElementById("keyword").value) + "&page=" + page + "&" + Math.random(), true); xmlHttp.onreadystatechange = function () { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { document.getElementById("div3").innerHTML = xmlHttp.responseText; } } } xmlHttp.send(null); document.getElementById("loading").style.display = "none"; document.getElementById("address").innerHTML = "> 站内搜索"; nowpage = page; } }