2 u010900249 u010900249 于 2013.05.30 23:45 提问

初学者,这段奇怪的代码啥意思啊,谢谢啦!
<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
franzhong   2013.05.31 10:01

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

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!