博客园  :: 首页  :: 管理

右侧菜单

Posted on 2006-01-24 10:29  Paker Liu  阅读(548)  评论(0编辑  收藏  举报
<style type="text/css">
<!--
body,td,a{
font-size:9pt;
color:#000000;
text-decoration:none;
cursor:default;
}
#MenuTable td a{
width:100%;
height:20;
background:;
}
#MenuTable td a:hover{
width:100%;
height:20;
background:#bfc7f2;
}
//-->
</style>
<script language="JScript">
<!--
var MenuText=["菜单一","菜单二","菜单三","菜单四","菜单五","菜单六","菜单七"];//菜单文字
var MenuEven=["alert(1)","alert(2)","alert(3)","alert(4)","alert(5)","alert(6)","alert(7)"];//菜单事件
var MenuSpeed=21;//菜单速度
var MenuWidth=100;//菜单宽度
var OldLeft;
document.write("<table  border='0' cellpadding='0' cellspacing='0' style='position:absolute;display:none;width:"+MenuWidth+";top:0;background:#f4f4f4;border:1 solid #cccccc;' id='MenuTable'>\n");
for(var i=0;i<MenuText.length;i++)document.write("<tr><td onclick='"+MenuEven[i]+"' height='20'><a href='#'>"+MenuText[i]+"</a></td></tr>\n");
document.write("<img style='position:absolute;left:-13' width='13' height='13' onclick='MoveMenu()' src='http://www.51js.com/images/51js/lastpost.gif'></table>\n");
function ResWin(){
    BodyWidth=document.body.offsetWidth;
    OldLeft=BodyWidth-20;
    MenuTable.style.left=OldLeft
    MenuTable.style.display="";
    }
function window.onload(){
    ResWin();
    document.body.style.overflowX="hidden";
    }
function window.onresize(){
    ResWin()
    }
function MoveMenu(){
    if(this.IsClickEven=="Over"||this.IsClickEven==null){
        this.str=function(){
            with(MenuTable.style){
                if(pixelLeft>OldLeft-pixelWidth){
                    pixelLeft-=MenuSpeed;
                    if(pixelLeft<OldLeft-(pixelWidth))pixelLeft=OldLeft-pixelWidth;
                    }
                else{
                    clearInterval(Inter);
                    this.IsClickEven="Out";
                    }
                }
            }
        }
    if(this.IsClickEven=="Out"){
        this.str=function(){
            with(MenuTable.style){
                if(pixelLeft<OldLeft){
                    pixelLeft+=MenuSpeed;
                    if(pixelLeft>OldLeft)pixelLeft=OldLeft;
                    }
                else{
                    clearInterval(Inter);
                    this.IsClickEven="Over";
                    }
                }
            }
        }
    var Inter=setInterval(this.str,10);
    }
//-->
</script>