有一个文件“caidan.php”,文件中代码:
====================================================================
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<SCRIPT language=JavaScript>
function move(x, y) {
if (document.all) {
object1.style.pixelLeft += x;
object1.style.pixelTop += y;}
else
if (document.layers) {
document.object1.left += x;
document.object1.top += y;
}};
function position() {
document.object1.left += 0;
document.object1.top += 0;
document.object1.visibility = "show"
};
function makeStatic() {
if (document.all) {object1.style.pixelTop=document.body.scrollTop+20}
else {eval('document.object1.top=eval(window.pageYOffset+20)');}
setTimeout("makeStatic()",0);}
</SCRIPT>
<STYLE type=text/css>.hl {BACKGROUND-COLOR: green; COLOR: white; CURSOR: hand}
.n {}
</STYLE>
<LAYER class=NS onMouseOut="move(-140, 0)"
onmouseover="move(140, 0)" left="0" bgcolor="black" name="object1" top="20"
visibility="hide">
<SCRIPT language=JavaScript>
if (document.all)
document.write('<DIV ID="object1" style="Position : Absolute ;Left : -180px ;Top : 0px ;Width : 0px ;Z-Index : 20">')
</SCRIPT>
<table bgColor=#698CC3 border=0 cellPadding=2 cellSpacing=1 width="190" height="608"
onmouseout="move(-180, 0)" onMouseOver="move(180,0)">
<TBODY>
<TR>
<TD height="20" align="center" valign="middle" bgColor=#009900 background="admin/img/left_bg_top1.png"><FONT face=宋体 size=3><B>导航菜单</B></FONT></TD>
<TD align=middle bgColor=#ffffff rowSpan=50 width=10>
<SCRIPT language=JavaScript>
if (document.all||document.layers)
document.write('<p align="center"><font size="2" face="Arial Black"><img src="img/switchOn.gif"></font></p>')
</SCRIPT>
</TD></TR>
<tr>
<td width="170" valign="top"><span id="menus"></span> <span id="view"></span>
<script>
function tree(n) {
var id = new Array("bar","pad","","");
if(n == 0) { // 初始化变量
n = 1;
i = 0;
s = "";
}
s += "<table>";
for(;i<tree_ar.length-1;i++) {
var k = (n >= tree_ar[i+1][0])?0:1;
s += "<tr id='"+id[k]+"' value="+i+"><td>"+id[k+2]+"</td><td>"+tree_ar[i][1]+"</td></tr>";
if(n > tree_ar[i+1][0]) {
s += "</td></tr></table>";
return tree_ar[i+1][0];
}
if(n < tree_ar[i+1][0]) {
s += "<tr style='display:none' v=1><td></td><td>";
var m = tree(tree_ar[++i][0]);
s += "</td></tr>";
if(m < n) {
s += "</table>";
return m;
}
}
}
s += "</table>";
return s;
}
</script>
<script for="pad" event="onclick">
// 分枝节点的点击响应
v = this.parentElement.rows[this.rowIndex+1].style;
if(v.display == 'block') {
v.display = 'none';
this.cells[0].innerHTML = "";
view.innerHTML = ""; // 自行修改为参数数组定义的闭合动作
}else {
v.display = 'block';
this.cells[0].innerHTML = "";
}
if(! tree_ar[this.value].type)
genTreeInfo(this);
var n = 1*this.value+1;
for(i=n;i<tree_ar.length-1;i++) {
if(tree_ar[i].type == "pad") {
tree_ar[i].obj2.style.display = 'none';
tree_ar[i].obj1.cells[0].innerHTML = "";
}
}
while(tree_ar[--n][0] > 1);
while(--n >= 0)
if(tree_ar[n].type == "pad") {
tree_ar[n].obj2.style.display = 'none';
tree_ar[n].obj1.cells[0].innerHTML = "";
}
function genTreeInfo(o) {
var el = o.parentElement;
for(var i=0;i<el.rows.length;i++) {
if(el.rows[i].id != "") {
tree_ar[el.rows[i].value].type = el.rows[i].id;
}
if(el.rows[i].id == "pad") {
tree_ar[el.rows[i].value].obj1 = el.rows[i];
tree_ar[el.rows[i].value].obj2 = el.rows[i+1];
}
}
}
</script>
<script for="bar" event="onclick">
// 无分枝节点的点击响应
</script>