?? 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 + -