forum.js
来自「用php编写的一个BBS 小程序」· JavaScript 代码 · 共 75 行
JS
75 行
/**
* forum.js
* 08.08.2007
*/
var _table = window.document.getElementById("tuple");
function waitThreadList(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", "5");
_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 insertThread(tRow, tUrl, tTitle, tHits, tPosts, tAuthor, tLastRe) {
if (tUrl == "0") {
waitThreadList(1, "暂无任何主题");
return;
}
var _tr = _table.insertRow(tRow);
_tr.style.background = "#eef2fd";
_tr.setAttribute("align", "center");
_tr.setAttribute("vAlign", "middle");
var _td = new Array();
var tStuff = new Array(tTitle, tHits, tPosts, tAuthor, tLastRe);
for (var i = 0; i < 5; i++) {
_td[i] = _tr.insertCell(i);
_td[i].setAttribute("className", "td1");
_td[i].setAttribute("onmouseover", new Function("this.style.background='#f6f8ff'"));
_td[i].setAttribute("onmouseout", new Function("this.style.background='#eef2fd'"));
_td[i].style.padding = "5px";
_td[i].innerHTML = tStuff[i];
}
_td[0].setAttribute("align", "left");
_td[0].setAttribute("onmouseover", new Function("this.style.cursor='hand';this.style.background='#f6f8ff'"));
_td[0].setAttribute("onmouseout", new Function("this.style.cursor='default';this.style.background='#eef2fd'"));
_td[0].setAttribute("onclick", new Function("window.location.href='" + tUrl + "'"));
}
function updateThreadList(curPage, rows, forum) {
forum = forum == null ? 0 : parseInt(forum);
rows = rows == null ? 0 : parseInt(rows);
curPage = curPage == null ? 0 : parseInt(curPage);
if (window.document.readyState == "complete") {
waitThreadList(1);
xajax_thread_list(curPage, rows, forum);
} else {
setTimeout(updateThreadList, 80, curPage, rows, forum);
}
}
function threadIssueReset() {
window.document.threadIssue.reset();
window.document.getElementById("sbjTStr").value = "";
window.document.getElementById("traTStr").value = "";
}
function threadIssueSubmit() {
window.document.threadIssue.bTIPost.disabled = true;
xajax_thread_issue(xajax.getFormValues("threadIssueForm"));
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?