zoukankan      html  css  js  c++  java
  • JavaScript实现动态导航

    JAVA脚本写的主要过程,效果不错但在。net下不能运行!


    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>导航菜单</title>
    <style type="text/css">
    .titleStyle{
    background-color:#006600;color:#ffffff;border-top:1px solid #FFFFFF;font-size:9pt;cursor:hand;
    }
    .contentStyle{
    background-color:#eeffee;color:blue;font-size:9pt;
    }

    a{
    color:blue;
    }
    body{
    font-size:9pt;
    }
    </style>
    </head>
    <body>

    <script language="JavaScript">
    <!--
     var layerTop=20;       //菜单顶边距
     var layerLeft=30;      //菜单左边距
     var layerWidth=140;    //菜单总宽
     var titleHeight=20;    //标题栏高度
     var contentHeight=200; //内容区高度
     var stepNo=10;         //移动步数,数值越大移动越慢

     var itemNo=0;runtimes=0;
     document.write('<span id=itemsLayer style="position:absolute;overflow:hidden;border:1px solid #008800;left:'+layerLeft+';top:'+layerTop+';'+layerWidth+';">');

     function addItem(itemTitle,itemContent){
       itemHTML='<div id=item'+itemNo+' itemIndex='+itemNo+' style="position:relative;left:0;top:'+(-contentHeight*itemNo)+';'+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('欢迎','<BR><img src="hehe.gif"/>');
     addItem('网页陶吧','<center><a href="#">网页工具</a> <BR><BR><a href="#">技术平台</a> <BR><BR><a href="#">设计理念</a> <BR><BR><a href="#">更多</a></center>');
     addItem('美工教室','<center><a href="#">平面设计 </a> <BR><BR><a href="#">三维空间</a> <BR><BR><a href="#">设计基础</a> <BR><BR><a href="#">更多..</a></center>');
     addItem('Flash','<center><a href="#">基础教程</a> <BR><BR><a href="#">技巧运用</a> <BR><BR><a href="#">实例剖析</a> <BR><BR><a href="#">更多..</a></center>');
     addItem('多媒体','<center><a href="#">DIRECTOR</a> <BR><BR><a href="#">Authorware</a> <BR><BR><a href="#">更多..</a></center>');
     addItem('精品赏析','<center><a href="#">设计精品</a></center>');

     document.write('</span>')
     document.all.itemsLayer.style.height=itemNo*titleHeight+contentHeight;

     toItemIndex=itemNo-1;onItemIndex=itemNo-1;

     function changeItem(clickItemIndex){
       toItemIndex=clickItemIndex;
       if(toItemIndex-onItemIndex>0) moveUp(); else moveDown();
       runtimes++;
       if(runtimes>=stepNo){
         onItemIndex=toItemIndex;
         runtimes=0;}
       else
         setTimeout("changeItem(toItemIndex)",10);
     }

     function moveUp(){
       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>

    </body>

     

  • 相关阅读:
    Binder核心原理解析
    写给 Android 应用工程师的 Binder 原理剖析
    Android Binder原理解析
    Android面试题(25)-Bundle机制_pgg_cold的博客-CSDN博客_android bundle机制
    腾讯Android面试精选题——谈一谈Binder的原理和实现一次拷贝的流程
    把这份关于Android Binder原理一系列笔记研究完,进大厂是个“加分项”...
    大型项目必备IPC之其他IPC方式(二)
    骚年!用Binder原理去彻底征服Android大厂面试官吧
    还不懂Binder的原理?那么你即将损失一张腾讯的offer
    每日一问 Binder
  • 原文地址:https://www.cnblogs.com/gudao119/p/1248300.html
Copyright © 2011-2022 走看看