📄 left.asp
字号:
<%
Dim strConn,objConn
Set objConn = Server.CreateObject("ADODB.CONNECTION")
strfilepath="data\crm.mdb"
strfilepath=server.MapPath(strfilepath)
StrConn="DBQ="&strfilepath&";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;"
objConn.Open StrConn
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="cssD.css" rel=stylesheet>
</head>
<body>
<script language="JavaScript">
var layerTop=0; //菜单顶边距
var layerLeft=0; //菜单左边距
var layerWidth=180; //菜单总宽度
var titleHeight=20; //标题栏高度
var contentHeight=529; //内容区高度
var layerHeight=526;
var stepNo=10; //移动步数,数值越大移动越慢
var itemNo=0;
//建立一个名为"itemsLayer"的层,用它限制所有菜单的显示范围:
document.write('<span id=itemsLayer style="position:absolute;overflow:hidden;border:1px solid #000000;left:'+layerLeft+';top:'+layerTop+';width:'+layerWidth+';">');
function addItem(itemTitle,itemContent,r_url){
//这个函数准备接受菜单标题和内容的写入
//新增菜单的顶点刚好在上一菜单的标题栏以下,尺寸由一开始便声明的变量决定
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+',"'+itemTitle+'"); class="titleStyle" onmouseover="changeTitleColor(this);" onmouseout="changeTitleColor(this);" align=center>'+itemTitle+'</td></tr>'+'<tr><td height='+contentHeight+' class="contentStyle" valign="top"><table width=100% border=0 cellspacing=0 cellpadding=0><tr><td hetght=10></td></tr></table>'+itemContent+'</td></tr> </table></div>';
document.write(itemHTML);
itemNo++;
}
//这时便可以把菜单标题和内容作为参数调用以上函数了:
//你可以添加任意多项,格式参照以下几行:
<%
strsql="select * from tech_cat where tech_cat_father_id=0"
Set objRs = Server.CreateObject("adodb.recordset")
objRs.Open strsql,objConn,1,1
brstr=chr(13)&chr(10)&chr(9)
if not objrs.eof then
do while not objrs.eof
response.write "addItem('" & objrs.fields("tech_cat_name") & "','"
response.write "<table width=100% border=0 cellspacing=0 cellpadding=0 height=100% >"
strsql="select * from tech_cat where tech_cat_father_id=" & objrs.fields("tech_cat_id")
Set objRs1 = Server.CreateObject("adodb.recordset")
objRs1.Open strsql,objConn,1,1
if not objrs1.eof then
do while not objrs1.eof
response.write "<tr><td align=center height=20 class=contentStyle onmouseover=changeItemColor(this) onmouseout=changeItemColor(this) onclick=openLRWin1("""",""" & objrs1.fields("tech_link") & """);>" & objrs1.fields("tech_cat_name") & "</td></tr>"
objrs1.movenext
loop
end if
response.write "<tr><td></td></tr></table>','');"
objrs.movenext
loop
end if
%>
document.write('</span>');
//结束"itemsLayer"层
//下面一式计算"itemsLayer"层的高度:
document.all.itemsLayer.style.height =layerHeight;
//itemNo*titleHeight+contentHeight;
//alert(itemNo);
contentHeight=contentHeight-itemNo*titleHeight;
//现在开始编写点击标题时移动相应的层:
//初始化变量"toItemIndex"和"onItemIndex",
//它们分别用于记录"应该显示的层"和"现在显示的层":
var toItemIndex=itemNo-1;
var onItemIndex=itemNo-1;
var strStatus="";
var tostrStatus="";
var runtimes=0; //"runtimes"用于记录层移动次数
//菜单标题被点击时调用这个函数:
function changeItem(clickItemIndex,strStatus){
//判断相应的层应上移还是下移:
toItemIndex=clickItemIndex;
tostrStatus=strStatus;
if(toItemIndex-onItemIndex>0) moveUp(); else moveDown();
//一定的时间间隔后继续移动,直到移了设定的步数stepNo:
runtimes++;
if(runtimes>=stepNo){
onItemIndex=toItemIndex;
runtimes=0;
}else{
setTimeout("changeItem(toItemIndex,tostrStatus)",10);
}
//设置状态
//if(tostrStatus!="undefined"){
// top.gstatus.innerHTML="<font color=#FFFFFF>"+tostrStatus+"</font>";
//}
}
//相应菜单上移:
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-1;');
}
}
var fs=document.all.item0.firstChild.firstChild.firstChild.firstChild.innerHTML;
changeItem(0,fs); //把第一个菜单作为默认显示
function changeTitleColor(obj)
{
cn=obj.className;
if(cn=="titleStyle"){
obj.className="titleStyleOver";
}else{
obj.className="titleStyle";
}
}
function changeItemColor(obj)
{
cn=obj.className;
if(cn=="contentStyle"){
obj.className="contentStyleOver";
}else{
obj.className="contentStyle";
}
}
function openLRWin1(strL,strR){
if(strL!=""){
if(top.leftframe!="undefined"){
top.leftframe.location=strL;
//top.leftframe.location.reload();
}
}
if(strR!=""){
if(top.right!="undefined"){
top.right.location=strR;
//alert(top.right.location);
}
}
}
//-->
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -