⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 left.php

📁 发布管理系统(sps)v2.0
💻 PHP
字号:
<?php
@include("global.inc");
@include("database.inc");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<base target="main">
<style type="text/css">
  .titleStyle{background-color:#CCFFCC;color:#CC33FF; border-top:1px solid #FFFFFF;font-size:9pt;cursor:hand; }
  .contentStyle{ background-color:#FFFFFF;color:#660000;font-size:9pt;vertical-align:top;}
</style>
</HEAD>

<BODY>
<script language="&#106avascript">
<!--
var layerTop=0;       //菜单顶边距
var layerLeft=5;      //菜单左边距
var layerWidth=120;    //菜单总宽度
var titleHeight=18;    //标题栏高度
var contentHeight=270; //内容区高度
var stepNo=10;         //移动步数,数值越大移动越慢
var itemNo=0;
//建立一个名为"itemsLayer"的层,用它限制所有菜单的显示范围:
document.write('<span id=itemsLayer style="position:absolute;overflow:hidden;left:'+layerLeft+';top:'+layerTop+';width:'+layerWidth+';">');
function addItem(itemTitle,itemContent){ 
	//这个函数准备接受菜单标题和内容的写入
	//新增菜单的顶点刚好在上一菜单的标题栏以下,尺寸由一开始便声明的变量决定
	itemHTML='<div id=item'+itemNo+' itemIndex='+itemNo+' style="position:relative;left:0;top:'+(-contentHeight*itemNo)+';width:'+layerWidth+';">'+       '<table width=100% cellspacing="0" cellpadding="0">'+       '<tr><td height='+titleHeight+' onclick=changeItem('+itemNo+') class="titleStyle" align=center>'+itemTitle+'</td></tr>'+       '<tr><td height='+contentHeight+' class="contentStyle">'+itemContent+'</td></tr> </table></div>';
	document.write(itemHTML);
	itemNo++;
}
//这时便可以把菜单标题和内容作为参数调用以上函数了:
//你可以添加任意多项,格式参照以下几行:
addItem('欢迎访问','<center><BR><A HREF="content.php">目录页面</A><BR><A HREF="admin_1.php">文件管理</A><BR><A HREF="admin_2.php">分类管理</A><BR><A HREF="admin_3.php">参数修改</A><BR><A HREF="http://gothere.512j.com/bbs/" target="_blank">技术支持</A><A HREF="rss2.xml" target="_blank"><BR><IMG SRC="xml.gif" WIDTH="36" HEIGHT="14" BORDER="0" ALT="订阅RSS"></A></center>');
<?php 
$str = "";
$type_rst = mysql_query("SELECT * FROM $table_type ORDER BY tid");
while ($type_row = mysql_fetch_array($type_rst)) {
	$str .= "addItem('".$type_row["type"]."','<center>";
	$db_rst = mysql_query("SELECT * FROM $table_db WHERE type='".$type_row["type"]."' ORDER BY id");
	while ($db_row = mysql_fetch_array($db_rst)) {
		$str .= "<BR>".$db_row["id"]."&nbsp;<a href=view.php?id=".$db_row["id"].">".$db_row["short_name"]."</a>";
	}
	mysql_free_result($db_rst);
	$str .=  "</center>');";
}	
mysql_free_result($type_rst);
echo $str;
?>
document.write('</span>');   //结束"itemsLayer"层

//下面一式计算"itemsLayer"层的高度:
document.all.itemsLayer.style.height =itemNo*titleHeight+contentHeight;
//现在开始编写点击标题时移动相应的层:
//初始化变量"toItemIndex"和"onItemIndex"
//它们分别用于记录"应该显示的层"和"现在显示的层":
var toItemIndex=itemNo-1;
var onItemIndex=itemNo-1;
var runtimes=0;  //"runtimes"用于记录层移动次数
//菜单标题被点击时调用这个函数:
function changeItem(clickItemIndex){
	//判断相应的层应上移还是下移:
	toItemIndex=clickItemIndex;
	if(toItemIndex-onItemIndex>0) moveUp(); else moveDown();
	//一定的时间间隔后继续移动,直到移了设定的步数stepNo:
	runtimes++;
	if(runtimes>=stepNo){
		onItemIndex=toItemIndex;
		runtimes=0;
	} else {
		setTimeout("changeItem(toItemIndex)",10);
	}
 }
//相应菜单上移:
function moveUp(){
	//判断应一起上移的菜单,并让它(们)每次移动contentHeight/stepNo的距离:
	for(i=onItemIndex+1;i<=toItemIndex;i++) {
		eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)-contentHeight/stepNo;');
	}
}
//相应菜单下移:
function moveDown(){
	for(i=onItemIndex;i>toItemIndex;i--)
	eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)+contentHeight/stepNo;');
}
changeItem(0); //把第一个菜单作为默认显示
//-->
</script>
<img src="http://gothere.512j.com/nalog504/nalogd.php?counter=work&url=<?=$HTTP_SERVER_VARS[HTTP_REFERER]?>" width=0 height=0>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -