thread.js
来自「用php编写的一个BBS 小程序」· JavaScript 代码 · 共 153 行
JS
153 行
/**
* thread.js
* 08.08.2007
*/
var _table = window.document.getElementById("tuple");
function waitPostList(state, clysis) {
var j = _table.rows.length;
for (var i = 1; i < j; i++) {
_table.deleteRow(1);
}
if (state == 1) {
var _tr = _table.insertRow(1);
_tr.style.background = "#eef2fd";
_tr.setAttribute("align", "center");
_tr.setAttribute("valign", "middle");
var _td = _tr.insertCell(0);
_td.setAttribute("className", "td1");
_td.setAttribute("colSpan", "4");
_td.setAttribute("onmouseover", new Function("this.style.background='#f6f8ff'"));
_td.setAttribute("onmouseout", new Function("this.style.background='#eef2fd'"));
_td.style.padding = "5px";
_td.innerHTML = clysis != null ? clysis : "请稍后,载入数据中...";
}
}
function insertPost(pRow, pPoster, pDate, pModify, pFloor, pGut, pAlter, pComment) {
if (pRow <= 0) {
var spot = "没有任何内容!";
if (pRow == -1) {
spot = "请登录后浏览此贴。";
window.document.getElementById("totalrows").innerHTML = "共有0个回贴";
window.document.getElementById("pagerows").value = 0;
window.document.getElementById("pageview").innerHTML = " ";
}
waitPostList(1, spot);
return;
}
var pStuff = new Array(pPoster, pDate, pModify, pFloor, pGut, pAlter, pComment);
var _tr = new Array();
var _td = new Array();
var k = (pRow - 1) * 4 + 1;
var n = (pRow - 1) * 7;
var trCell = new Array(4, 1, 1, 1);
var tdClass = new Array(1, 3, 3, 1, 2, 2, 1);
var count = 0;
for (var i = 0; i < 4; i++) {
_tr[i] = _table.insertRow(k+i);
_tr[i].style.background = "#eef2fd";
for (var j = 0; j < trCell[i]; j++) {
_td[count] = _tr[i].insertCell(j);
_td[count].setAttribute("className", "td" + tdClass[count]);
_td[count].setAttribute("id", "tC" + (n + count));
_td[count].style.padding = "5px";
_td[count].innerHTML = pStuff[count];
count++;
}
}
_td[0].setAttribute("onmouseover", new Function("this.style.background='#f6f8ff'"));
_td[0].setAttribute("onmouseout", new Function("this.style.background='#eef2fd'"));
_td[0].setAttribute("rowSpan", "4");
_td[0].setAttribute("vAlign", "top");
_td[1].setAttribute("width", "35%");
_td[2].setAttribute("width", "35%");
_td[2].setAttribute("align", "right");
_td[3].setAttribute("width", "10%");
_td[3].setAttribute("align", "right");
_td[4].setAttribute("colSpan", "3");
_td[4].setAttribute("height", "180px");
_td[4].setAttribute("vAlign", "top");
_td[5].setAttribute("colSpan", "3");
_td[5].setAttribute("vAlign", "bottom");
_td[5].style.color = "#808080";
_td[5].style.paddingBottom = "0px";
_td[6].setAttribute("colSpan", "3");
_td[6].setAttribute("vAlign", "bottom");
_td[6].style.paddingTop = "0px";
for (i = 0; i < 2; i++) {
j = i * 3 + n + 1;
var t1Obj = window.document.getElementById("tC" + j);
var t2Obj = window.document.getElementById("tC" + (j+1));
var t3Obj = window.document.getElementById("tC" + (j+2));
t1Obj.setAttribute("onmouseover", new Function("this.style.background='#f6f8ff';window.document.getElementById(\"tC" + (j+1) + "\").style.background='#f6f8ff';window.document.getElementById(\"tC" + (j+2) + "\").style.background='#f6f8ff'"));
t1Obj.setAttribute("onmouseout", new Function("this.style.background='#eef2fd';window.document.getElementById(\"tC" + (j+1) + "\").style.background='#eef2fd';window.document.getElementById(\"tC" + (j+2) + "\").style.background='#eef2fd'"));
t2Obj.setAttribute("onmouseover", new Function("this.style.background='#f6f8ff';window.document.getElementById(\"tC" + j + "\").style.background='#f6f8ff';window.document.getElementById(\"tC" + (j+2) + "\").style.background='#f6f8ff'"));
t2Obj.setAttribute("onmouseout", new Function("this.style.background='#eef2fd';window.document.getElementById(\"tC" + j + "\").style.background='#eef2fd';window.document.getElementById(\"tC" + (j+2) + "\").style.background='#eef2fd'"));
t3Obj.setAttribute("onmouseover", new Function("this.style.background='#f6f8ff';window.document.getElementById(\"tC" + j + "\").style.background='#f6f8ff';window.document.getElementById(\"tC" + (j+1) + "\").style.background='#f6f8ff'"));
t3Obj.setAttribute("onmouseout", new Function("this.style.background='#eef2fd';window.document.getElementById(\"tC" + j + "\").style.background='#eef2fd';window.document.getElementById(\"tC" + (j+1) + "\").style.background='#eef2fd'"));
}
}
function updatePostList(curPage, rows, thread) {
thread = thread == null ? 0 : parseInt(thread);
rows = rows == null ? 0 : parseInt(rows);
curPage = curPage == null ? 0 : parseInt(curPage);
if (window.document.readyState == "complete") {
waitPostList(1);
xajax_post_list(curPage, rows, thread);
} else {
setTimeout(updatePostList, 80, curPage, rows, thread);
}
}
function postIssueReset() {
window.document.postIssue.reset();
window.document.getElementById("sbjPStr").value = "";
window.document.getElementById("traPStr").value = "";
}
function postIssueSubmit() {
window.document.postIssue.bPIPost.disabled = true;
xajax_post_issue(xajax.getFormValues("postIssueForm"));
}
function modifyPostReset() {
window.document.modifyPost.reset();
window.document.getElementById("sbjMStr").value = "";
window.document.getElementById("traMStr").value = "";
}
function modifyPostRefit() {
var obj = window.document.modifyPost;
var pId = obj.mPpId.value;
var tCId = obj.mPtCId.value;
var is1st = obj.mP1st.value;
obj.bMPEdit.disabled = obj.bMPRefit.disabled = true;
modifyPostReset();
obj.mPpId.value = pId;
obj.mPtCId.value = tCId;
obj.mP1st.value = is1st;
xajax_modify_post(pId);
}
function modifyPostRefresh(pId, tCId, isFirst) {
if (event.button == 1) {
var obj = window.document.modifyPost;
obj.bMPEdit.disabled = obj.bMPRefit.disabled = true;
modifyPostReset();
showDivAdv(8, true);
isFirst = isFirst == null ? 0 : (isFirst ? 1 : 0);
obj.mPpId.value = pId;
obj.mPtCId.value = tCId;
obj.mP1st.value = isFirst;
xajax_modify_post(pId);
}
}
function modifyPostSubmit() {
var obj = window.document.modifyPost;
obj.bMPEdit.disabled = obj.bMPRefit.disabled = true;
xajax_modify_post(-1, xajax.getFormValues("modifyPostForm"));
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?