| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 564 人关注过本帖
标题:关于首页导航函数的请教
只看楼主 加入收藏
xxgszzx
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2011-11-30
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:2 
关于首页导航函数的请教
我这有以一段关于首页导航的函数,请帮忙修改一下,我想实现导航为横向的。
Function GetMenu()
    dim pop,rs_item,j,id
    pop = "<DIV class=menuskin id=popmenu onmouseover=clearhidemenu();highlightmenu(event,'on') onmouseout=highlightmenu(event,'off');dynamichide(event) style='Z-index:100'></DIV>"&vbnewline
    pop = pop &"<script Language=Javascript src='images/pop.js'></script>"&vbnewline
    pop = pop &"<script language=javascript>"&vbnewline
    '新闻菜单
    pop = pop &"linkset[0]=new Array()"&vbnewline
    Sql="Select * from Ft_news_cat order by cat_id"
    set rs_item=server.createobject("adodb.recordset")
    rs_item.open sql,conn,1,1
    dim i
    i = -1
    do while not rs_item.eof
        i=i+1
        pop = pop &"linkset[0]["&i&"]='<div class=menuitems align=left><a href=news.asp?cat_id="&rs_item(0)&">"&rs_item(1)&"</a></div>'"&vbnewline
        rs_item.movenext
    loop
    rs_item.close
    '图片菜单
    pop = pop &"linkset[1]=new Array()"&vbnewline
    Sql="Select * from Ft_pic_cat order by cat_id"
    set rs_item=server.createobject("adodb.recordset")
    rs_item.open sql,conn,1,1
    i = -1
    do while not rs_item.eof
        i=i+1
        pop = pop &"linkset[1]["&i&"]='<div class=menuitems align=left><a href=pic.asp?cat_id="&rs_item(0)&">"&rs_item(1)&"</a></div>'"&vbnewline
        rs_item.movenext
    loop
    rs_item.close
    '文章菜单
    pop = pop &"linkset[2]=new Array()"&vbnewline
    Sql="Select * from Ft_art_cat order by cat_id"
    set rs_item=server.createobject("adodb.recordset")
    rs_item.open sql,conn,1,1
    i = -1
    do while not rs_item.eof
        i=i+1
        pop = pop &"linkset[2]["&i&"]='<div class=menuitems align=left><a href=article.asp?cat_id="&rs_item(0)&">"&rs_item(1)&"</a></div>'"&vbnewline
        rs_item.movenext
    loop
    rs_item.close
    '下载菜单
    pop = pop &"linkset[3]=new Array()"&vbnewline
    Sql="Select * from Ft_soft_cat order by cat_id"
    set rs_item=server.createobject("adodb.recordset")
    rs_item.open sql,conn,1,1
    i = -1
    do while not rs_item.eof
        i=i+1
        pop = pop &"linkset[3]["&i&"]='<div class=menuitems align=left><a href=download.asp?cat_id="&rs_item(0)&">"&rs_item(1)&"</a></div>'"&vbnewline
        rs_item.movenext
    loop
    rs_item.close
    '影音菜单
    pop = pop &"linkset[4]=new Array()"&vbnewline
    Sql="Select * from Ft_dj_cat order by cat_id"
    set rs_item=server.createobject("adodb.recordset")
    rs_item.open sql,conn,1,1
    i = -1
    do while not rs_item.eof
        i=i+1
        pop = pop &"linkset[4]["&i&"]='<div class=menuitems align=left><a href=dj.asp?cat_id="&rs_item(0)&">"&rs_item(1)&"</a></div>'"&vbnewline
        rs_item.movenext
    loop
    rs_item.close
    '教程菜单
    pop = pop &"linkset[5]=new Array()"&vbnewline
    Sql="Select * from Ft_course_cat order by cat_id"
    set rs_item=server.createobject("adodb.recordset")
    rs_item.open sql,conn,1,1
    i = -1
    do while not rs_item.eof
        i=i+1
        pop = pop &"linkset[5]["&i&"]='<div class=menuitems align=left><a href=course.asp?cat_id="&rs_item(0)&">"&rs_item(1)&"</a></div>'"&vbnewline
        rs_item.movenext
    loop
    rs_item.close
    '风格菜单
    dim x,y
    y = LCase(request.ServerVariables("QUERY_STRING"))
    if y = "" then
        x = ""
    else
        if InStr(y,"skin") > 0 then
            x = replace(y,right(y,5+len(Skin)),"")
            if x<>"" then
                if right(x,1)<>"&" then x=x&"&"
            end if
        else
            x = y & "&"
        end if
    end if
    pop = pop &"linkset[6]=new Array()"&vbnewline
    pop = pop &"linkset[6][0]='<div class=menuitems><a href=?"&x&"skin=0>恢复默认设置</a></div>'"&vbnewline
    Sql="Select * from Ft_mb_style"
    set rs_item=server.createobject("adodb.recordset")
    rs_item.open sql,conn,1,1
    i = 0
    do while not rs_item.eof
        i=i+1
        if Cint(Skin) = rs_item(0) then
            pop = pop &"linkset[6]["&i&"]='<div class=menuitems align=left><a href=?"&x&"skin="&rs_item(0)&">├&nbsp;<font color=red>"&rs_item(1)&"</font></a></div>'"&vbnewline
        else
            pop = pop &"linkset[6]["&i&"]='<div class=menuitems align=left><a href=?"&x&"skin="&rs_item(0)&">├&nbsp;"&rs_item(1)&"</a></div>'"&vbnewline
        end if
    rs_item.movenext
    loop
    rs_item.close
    Sql="select * from Ft_menu where items=0 and shown=true and navwz=1 order by order_num"
    Set Rs=Server.Createobject("adodb.recordset")
    Rs.open Sql,conn,1,1
    dim script,tmp,sql2,rs2,m
    j=6
    m=0
    do while not Rs.Eof
        sql2="select * from Ft_menu where items="&rs(0)
        set rs2=server.createobject("adodb.recordset")
        rs2.open sql2,conn,1,1
        if rs2.bof and rs2.eof then
            if rs(0) = 2 then
                 tmp = "<a href='"&rs(2)&"' target='"&rs(3)&"' onmouseover=showmenu(event,0,1,false) onmouseout=delayhidemenu()>"& rs(1) &"</a> | "
            elseif rs(0) =3 then
                tmp = "<a href='"&rs(2)&"' target='"&rs(3)&"' onmouseover=showmenu(event,1,1,false) onmouseout=delayhidemenu()>"& rs(1) &"</a> | "
            elseif rs(0) =4 then
                tmp = "<a href='"&rs(2)&"' target='"&rs(3)&"' onmouseover=showmenu(event,2,1,false) onmouseout=delayhidemenu()>"& rs(1) &"</a> | "
            elseif rs(0) =5 then
                tmp = "<a href='"&rs(2)&"' target='"&rs(3)&"' onmouseover=showmenu(event,3,1,false) onmouseout=delayhidemenu()>"& rs(1) &"</a> | "
            elseif rs(0) =6 then
                tmp = "<a href='"&rs(2)&"' target='"&rs(3)&"' onmouseover=showmenu(event,4,1,false) onmouseout=delayhidemenu()>"& rs(1) &"</a> | "
            elseif rs(0) =7 then
                tmp = "<a href='"&rs(2)&"' target='"&rs(3)&"' onmouseover=showmenu(event,5,1,false) onmouseout=delayhidemenu()>"& rs(1) &"</a> | "
            elseif rs(0) =8 then
                tmp = "<a href='"&rs(2)&"' target='"&rs(3)&"' onmouseover=showmenu(event,6,1,false) onmouseout=delayhidemenu()>"& rs(1) &"</a> | "
            else
                tmp = "<a href='"&rs(2)&"' target='"&rs(3)&"'>"& rs(1) &"</a> | "
            end if
            j=j
        else
            j=j+1
            id=j
            pop = pop &"linkset["&j&"]=new Array()"&vbnewline
            Sql="Select * from Ft_menu where shown=True And items="&rs(0)
            set rs_item=server.createobject("adodb.recordset")
            rs_item.open sql,conn,1,1
            i = -1
            do while not rs_item.eof
                i=i+1
                pop = pop &"linkset["&j&"]["&i&"]='<div class=menuitems align=left><a href="&rs_item(2)&" target="&rs_item(3)&">"&rs_item(1)&"</a></div>'"&vbnewline
                rs_item.movenext
            loop
            rs_item.close:set rs_item=nothing
        tmp = "<a href='"&rs(2)&"' target='"&rs(3)&"' onmouseover=showmenu(event,"&id&",1,false) onmouseout=delayhidemenu()>"& rs(1) &"</a> | "
        end if
        rs2.close:set rs2=nothing
        m=m+1
        if menunum<>0 and m>=menunum then
            script = script & tmp&"<br>"
            m=0
        else
            script = script & tmp
        end if
        Rs.movenext
    loop
    Rs.Close:Set Rs=Nothing
    if Right(script,4)="<br>" then script=Left(script,Len(script)-4)
    Getmenu=Left(script,len(script)-3)&VbCrLf+pop &"</script>"&VbCrLf
End function
搜索更多相关主题的帖子: pop 导航 images 
2011-11-30 22:32
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
收藏
得分:14 
没有数据库,没有JS别人怎么帮你改。

QQ:63572063
2011-12-01 21:33
xxgszzx
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2011-11-30
收藏
得分:0 
以下是pop.js
var menuOffX=0    //菜单距连接文字最左端距离
var menuOffY=22    //菜单距连接文字顶端距离
var fo_shadows=new Array()
var linkset=new Array()
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
var ns4=document.layers
function showmenu(e,index,p,paging){
    if (!document.all&&!document.getElementById&&!document.layers)
        return
    which=linkset[index]
    var pSize=10    //每页连接数
    var pNum=Math.floor((which.length-1)/pSize)+1        //页数
    clearhidemenu()
    ie_clearshadow()
    which=which.join("")
    menuobj=ie4? document.all.popmenu : ns6? document.getElementById("popmenu") : ns4? document.popmenu : ""
    menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj
   
    if (ie4||ns6)
        menuobj.innerHTML=which
    else{
        menuobj.document.write('<layer name=gui bgColor=#E6E6E6 width=165 onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+which+'</layer>')
        menuobj.document.close()
    }
    menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width
    menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.gui.document.height
    eventX=ie4? event.clientX : ns6? e.clientX : e.x
    eventY=ie4? event.clientY : ns6? e.clientY : e.y
    var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
    var bottomedge=ie4? document.body.clientHeight-eventY : window.innerHeight-eventY
    if (!paging)
    {
        if (rightedge<menuobj.contentwidth)
            menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth+menuOffX : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth
        else
            menuobj.thestyle.left=ie4? ie_x(event.srcElement)+menuOffX : ns6? window.pageXOffset+eventX : eventX
        if (bottomedge<menuobj.contentheight)
            menuobj.thestyle.top=ie4? document.body.scrollTop+eventY-menuobj.contentheight-event.offsetY+menuOffY : ns6? window.pageYOffset+eventY-menuobj.contentheight : eventY-menuobj.contentheight
        else
            menuobj.thestyle.top=ie4? ie_y(event.srcElement)+menuOffY : ns6? window.pageYOffset+eventY+menuOffY/2 : eventY
    }
    menuobj.thestyle.visibility="visible"
    ie_dropshadow(menuobj,"#CCCCCC",3)
    return false
}
function ie_x(e){
    var l=e.offsetLeft;
    while(e=e.offsetParent){
        l+=e.offsetLeft;
    }
    return l;
}
function ie_y(e){
    var t=e.offsetTop;
    while(e=e.offsetParent){
        t+=e.offsetTop;
    }
    return t;
}
function ie_dropshadow(el, color, size)
{
    var i;
    for (i=size; i>0; i--)
    {
        var rect = document.createElement('div');
        var rs = rect.style
        rs.position = 'absolute';
        rs.left = (el.style.posLeft + i) + 'px';
        rs.top = (el.style.posTop + i) + 'px';
        rs.width = el.offsetWidth + 'px';
        rs.height = el.offsetHeight + 'px';
        rs.zIndex = el.style.zIndex - i;
        rs.backgroundColor = color;
        var opacity = 1 - i / (i + 1);
        rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
        //el.insertAdjacentElement('afterEnd', rect);        // 输出阴影,若不想要投影,可以注释此句
        fo_shadows[fo_shadows.length] = rect;
    }
}
function ie_clearshadow()
{
    for(var i=0;i<fo_shadows.length;i++)
    {
        if (fo_shadows[i])
            fo_shadows[i].style.display="none"
    }
    fo_shadows=new Array();
}
function contains_ns6(a, b) {
    while (b.parentNode)
        if ((b = b.parentNode) == a)
            return true;
    return false;
}
function hidemenu(){
    if (window.menuobj)
        menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
    ie_clearshadow()
}
function dynamichide(e){
    if (ie4&&!menuobj.contains(e.toElement))
        hidemenu()
    else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
        hidemenu()
}
function delayhidemenu(){
    if (ie4||ns6||ns4)
        delayhide=setTimeout("hidemenu()",500)
}
function clearhidemenu(){
    if (window.delayhide)
        clearTimeout(delayhide)
}
function highlightmenu(e,state){
    if (document.all)
        source_el=event.srcElement
    else if (document.getElementById)
        source_el=e.target
    if (source_el.className=="menuitems"){
        source_el.id=(state=="on")? "mouseoverstyle" : ""
    }
    else{
        while(source_el.id!="popmenu"){
            source_el=document.getElementById? source_el.parentNode : source_el.parentElement
            if (source_el.className=="menuitems"){
                source_el.id=(state=="on")? "mouseoverstyle" : ""
            }
        }
    }
}
if (ie4||ns6)
document.onclick=hidemenu
function bbimg(o){
    var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
    return false;
}
2011-12-01 23:29
快速回复:关于首页导航函数的请教
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020352 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved