qq_31788907 2016-05-10 08:26 采纳率: 69.2%
浏览 1047
已采纳

这段代码的意义是什么

图片说明
function grabEvent(__key_code) {
var key_code = 0;
if (__USER_AGENT__ == 'android')
{
key_code = __key_code;
}
else
{
key_code = transform_key_value(event.which || event.keyCode);
}

if (key_code < 58 && key_code > 47)
{
key_code = key_code - 48;
if (body_selector_show && body_focus_area == 1)
{
get_num(key_code);
}
return 0;
}
else
{
switch(key_code) {
case 1://up
if (error_show || wait_tips)
{
return 0;
}
if (body_selector_show)
{
if(body_focus_area == 1) {
if(keyPadWeight.focusIdx < 6) {
//to 顶部
$("focusInputItem").style.left = inputItemPos[body_pos] + "px";
$("focusInputItem").style.visibility = "visible";
body_focus_area = 0;
$("keyborad_focus").style.visibility = "hidden";
set_input_style(0);
} else {
keyPadWeight.focusChg(-6);
}
}
}
else
{
if (focus_area == 1)
{

                    focus_area = 0;
                    $("uu" + pos).style.visibility = "hidden";
                    $("u" + pos).style.visibility = "visible";
                    $("gb1").style.visibility = "hidden";
                }
            }
            return 0;
            break;              
        case 2://down                  
            if (error_show || wait_tips)
            {
                return 0;
            }
            if (body_selector_show)
            {
                if (body_focus_area == 0)
                {
                    $("keyborad_focus").style.visibility = "visible";
                    $("focusInputItem").style.visibility = "hidden";
                    input_objs[body_pos].showCursor();
                    body_focus_area = 1;
                } else if(body_focus_area == 1) {
                    if(keyPadWeight.focusIdx < 6) {
                        keyPadWeight.focusChg(6);
                    }
                }
            }
            else 
            {
                if (focus_area == 0)
                {

                    focus_area = 1;
                    $("uu" + pos).style.visibility = "visible";
                    $("u" + pos).style.visibility = "hidden";
                    $("gb1").style.visibility = "visible";
                }
            }
            return 0;               
            break;              
        case 3://left   
            if (error_show || wait_tips)
            {
                return 0;
            }
            if (sex_selector_show)
            {
                change_sex_pos(-1);
                return 0;
            }
            else if (vocation_selector_show)
            {
                change_vocation_pos(-1);
                return 0;
            }
            else if (body_selector_show)
            {
                if (body_focus_area == 0)
                {
                    if(body_pos > 0) {
                        body_pos--;
                        $("focusInputItem").style.left = inputItemPos[body_pos] + "px";
                    }
                } 
                else if(body_focus_area == 1) 
                {
                    keyPadWeight.focusChg(-1);
                }
                return 0;
            }
            if (focus_area == 1)
            {
                change_icon_focus(-1);
            }
            return 0;
            break;
        case 4://right              
            if (error_show || wait_tips)
            {
                return 0;
            }
            if (sex_selector_show)
            {
                change_sex_pos(1);
                return 0;
            }
            else if (vocation_selector_show)
            {
                change_vocation_pos(1);
                return 0;
            }
            else if (body_selector_show)
            {
                if (body_focus_area == 0)
                {
                    if(body_pos < 2) {
                        body_pos++;
                        $("focusInputItem").style.left = inputItemPos[body_pos] + "px";
                    }
                }
                else if(body_focus_area == 1) 
                {
                    keyPadWeight.focusChg(1);
                }
                    return 0;
            }
            if (focus_area == 1)
            {
                change_icon_focus(1);
            }
            return 0;
            break;


    }

}   
return 1;   

}

function change_icon_focus(__num)
{
if (pos == 0 && __num < 0) return;
if (pos == 8 && __num > 0) return;
$("uu" + pos).style.visibility = "hidden";
$("u" + pos).style.visibility = "visible";
pos += __num;
$("uu" + pos).style.visibility = "visible";
$("u" + pos).style.visibility = "hidden";
$("gb1").style.top = focus_index[pos] + "px";
}

function $(id)
{
return document.getElementById(id);
}

  • 写回答

2条回答 默认 最新

  • minge0001 2016-05-10 08:59
    关注

    sex_selector_show,vocation_selector_show分别是两个判断条件,满足sex_selector_show=true的话走change_sex_pos(-1)方法,否则如果满足vocation_selector_show=true的话走change_vocation_pos(-1)方法,具体是什么意思,可以看看他们是在哪里定义的,还有在哪里赋了值

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 spring后端vue前端
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题