Budonge 2013-05-30 15:45 采纳率: 0%
浏览 1747

初学者,这段奇怪的代码啥意思啊,谢谢啦!

<script>
var temp_num = null;
var now_num  = null;

var the_top = 159;  //表单的最高,最低
var the_bottom = 178 

var no_can_do = false;

function Show_menu(u_num,d_num)
{
    event.srcElement.className = "out2";

    if(no_can_do)
    {
        return;
    }   

    now_num = d_num;

    if(temp_num)    
    {
        if(document.getElementById("menu_"+temp_num).doing)
        {
            clearInterval(document.getElementById("menu_"+temp_num).doing);
        }
    }
    else
    {
        temp_num = u_num;
    }

    document.getElementById("menu_"+temp_num).doing = setInterval("set_menu()",10);

}

function set_menu()
{
    no_can_do = true;

    document.getElementById("form_"+temp_num).style.display = "none";

    var if_move = document.getElementById("div_"+temp_num).style.pixelHeight - 6;


    if(if_move>1)
    {
        document.getElementById("div_"+temp_num).style.pixelHeight = if_move;
    }
    else
    {
        document.getElementById("div_"+temp_num).style.pixelHeight = 1;

        var if_stop = document.getElementById("menu_"+temp_num).style.pixelTop - 1;

        if(if_stop>the_top)
        {
            document.getElementById("menu_"+temp_num).style.pixelTop = if_stop;
            document.getElementById("menu_"+now_num).style.pixelTop += 1;
        }
        else
        {
            document.getElementById("menu_"+temp_num).style.pixelTop = the_top;
            document.getElementById("menu_"+now_num).style.pixelTop = the_bottom;

            var if_end = document.getElementById("div_"+now_num).style.pixelHeight + 6;

            if(if_end < 182)
            {
                document.getElementById("div_"+now_num).style.pixelHeight = if_end
            }
            else
            {
                document.getElementById("div_"+now_num).style.pixelHeight = 182;

                clearInterval(document.getElementById("menu_"+temp_num).doing);

                document.getElementById("menu_"+temp_num).doing = false;

                document.getElementById("form_"+now_num).style.display = "block";

                temp_num = null;

                no_can_do = false;
            }

        }

    }

}

function returnIT()
{
    event.srcElement.className = "out";
}
</script>
<script LANGUAGE="javascript">
<!--
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
  • 写回答

1条回答

  • franzhong 2013-05-31 02:01
    关注

    看起来像是个动画效果
    里面有定时触发来改变Form/div/menu等内容的CSS属性

    评论

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示