使用,号:

$("#goodSource,#mailState") 选择了id为goodSource或者mailState的元素,当两者之间有任何一个有改变时,将会触发该操作。
//处理点击“物品来源”和“邮寄状态”事件
$("#goodSource,#mailState").change(function(){
    var goodSourceId = $("#goodSource").children('option:selected').val();
    alert($("#mailState").children('option:selected').val());
    if (goodSourceId == 0) { //选择全部显示
        renewPage(mailInfo);
        return;
    }
    var tmp = new Array();
    for(var i=0,j=0;i<mailInfo.length;i++) {
        if (!(mailInfo instanceof Array) ) {
            break;
        }
        if (mailInfo[i].goodSource == goodSourceId) {
            tmp[j++] = mailInfo[i];
        }
    }
    renewPage(tmp);
})

 程序猿必读

posted on 2016-10-11 17:30  龙种人  阅读(186)  评论(0编辑  收藏  举报