DangAn 一次js

//根据选中的省填充市级下拉框
function getName(){
    var sheng = $(‘#sheng‘).find("option:selected").text();
    if(sheng ==""){
        //市级按钮设置为不可用
        $("#shi").attr("disabled",true);
        return;
    }
    $.ajax({
        type : "POST",
                url : "http://localhost:8090/shiQu.do?SHENG="+sheng,
        data : {},
        dataType : ‘json‘,
        //返回jsonArray
        success : function(res) {
            $("#shi").empty();
            $("#shi").append("<option value=‘‘  style=‘display:none‘>请选择</option>");
            //省下面的市循环输出到下拉框
            for(i=0 ; i<res.length;i++){
            $("#shi").append(
            "<option value=‘"+res[i].code+"‘>"+res[i].name
            + "</option>");
            }
            
        }
    });
}



//提交表单
function submit(){
    var Mobile = $(‘#Mobile‘).val();
    var sheng = $(‘#sheng‘).val();
    var shi = $(‘#shi‘).val();
    var qu = $(‘#qu‘).val();
    var Radios2 = $(‘#opRadios2‘).val();
    var Radios3 = $(‘#opRadios3‘).val();
    //判断选中的radio 选2和3 邮编和地址为必填
    var val=$(‘input:radio[name="opRadios"]:checked‘).val();
    var yzbm = $(‘#yzbm‘).val();
    var Addressee = $(‘#Addressee‘).val();
    if(Mobile==‘‘||sheng==null||shi==null||qu==null){
        alert("请完善信息!");
        return;
    }
    if(val==Radios2||val==Radios3){
        if(yzbm==‘‘||Addressee==‘‘){
            alert("请完善信息!");
            return;
        }
    }
        $.ajax({
            type : "POST",
             async: false,
             url : "http://localhost:8090/ac-product-net/Save.do",
            data : $(‘#from‘).serialize(),
            dataType : "json",
            error : function() {
                alert("系统繁忙,请稍后再试!");
            },
            success : function(resData) {
                if(resData.code=="200"){
                    window.location.href =  "http://localhost:8090/ac-product-net/success.jsp";
                }else {
                    alert("系统繁忙,请稍后再试!");
                }
            }
        });
    }


//进入页面先加载:
            window.onload=function(){
                //定义一个年份下拉框            
                var myDate= new Date(); 
                var startYear=myDate.getFullYear()-50;//起始年份 
                var endYear=myDate.getFullYear();//结束年份 
                //下拉框name属性:‘Year‘
                var obj=document.getElementById(‘Year‘) 
                //obj.options.add(new Option(0,‘请选择‘)); 
                $("#Year").append("<option value=‘‘  style=‘display:none‘>请选择</option>");
                for (var i=startYear;i<=endYear;i++) { 
                obj.options.add(new Option(i,i)); 
            } 
                //obj.options[obj.options.length-51].selected=1; 
                
                
                //根据预填的身份证号码判断男女,填入到其他文本框
                if(zjhm.length==18){
                    if (parseInt(zjhm.substr(16, 1)) % 2 == 1) { 
                        $(‘#Man‘).val(xm);
                        $(‘#Manidenfication‘).val(zjhm);
                        $("#Man").attr("readonly","readonly");
                        $("#Manidenfication").attr("readonly","readonly");
                    }else{
                        $(‘#Woman‘).val(xm);
                        $(‘#Womanidenfication‘).val(zjhm);
                        $("#Woman").attr("readonly","readonly");
                        $("#Womanidenfication").attr("readonly","readonly");
                    }
                }else{
                    if (parseInt(zjhm.substr(14, 1)) % 2 == 1) { 
                        $(‘#Man‘).val(xm);
                        $(‘#Manidenfication‘).val(zjhm);
                        $("#Man").attr("readonly","readonly");
                        $("#Manidenfication").attr("readonly","readonly");
                    }else{
                        $(‘#Woman‘).val(xm);
                        $(‘#Womanidenfication‘).val(zjhm);
                        $("#Woman").attr("readonly","readonly");
                        $("#Womanidenfication").attr("readonly","readonly");
                    }
                }
        } 

 


//根据选中的省填充市级下拉框function getName(){var sheng = $(‘#sheng‘).find("option:selected").text();if(sheng ==""){//市级按钮设置为不可用$("#shi").attr("disabled",true);return;}$.ajax({type : "POST",url : "http://localhost:8090/shiQu.do?SHENG="+sheng,data : {},dataType : ‘json‘,//返回jsonArraysuccess : function(res) {$("#shi").empty();$("#shi").append("<option value=‘‘  style=‘display:none‘>请选择</option>");//省下面的市循环输出到下拉框for(i=0 ; i<res.length;i++){$("#shi").append("<option value=‘"+res[i].code+"‘>"+res[i].name+ "</option>");}}});}


//提交表单function submit(){var Mobile = $(‘#Mobile‘).val();var sheng = $(‘#sheng‘).val();var shi = $(‘#shi‘).val();var qu = $(‘#qu‘).val();var Radios2 = $(‘#opRadios2‘).val();var Radios3 = $(‘#opRadios3‘).val();//判断选中的radio 选2和3 邮编和地址为必填var val=$(‘input:radio[name="opRadios"]:checked‘).val();var yzbm = $(‘#yzbm‘).val();var Addressee = $(‘#Addressee‘).val();if(Mobile==‘‘||sheng==null||shi==null||qu==null){alert("请完善信息!");return;}if(val==Radios2||val==Radios3){if(yzbm==‘‘||Addressee==‘‘){alert("请完善信息!");return;}}$.ajax({type : "POST", async: false, url : "http://localhost:8090/ac-product-net/Save.do",data : $(‘#from‘).serialize(),dataType : "json",error : function() {alert("系统繁忙,请稍后再试!");},success : function(resData) {if(resData.code=="200"){window.location.href =  "http://localhost:8090/ac-product-net/success.jsp";}else {alert("系统繁忙,请稍后再试!");}}});}

//进入页面先加载:window.onload=function(){//定义一个年份下拉框var myDate= new Date(); var startYear=myDate.getFullYear()-50;//起始年份 var endYear=myDate.getFullYear();//结束年份 //下拉框name属性:‘Year‘var obj=document.getElementById(‘Year‘) //obj.options.add(new Option(0,‘请选择‘)); $("#Year").append("<option value=‘‘  style=‘display:none‘>请选择</option>");for (var i=startYear;i<=endYear;i++) { obj.options.add(new Option(i,i)); } //obj.options[obj.options.length-51].selected=1; //根据预填的身份证号码判断男女,填入到其他文本框if(zjhm.length==18){if (parseInt(zjhm.substr(16, 1)) % 2 == 1) { $(‘#Man‘).val(xm);$(‘#Manidenfication‘).val(zjhm);$("#Man").attr("readonly","readonly");$("#Manidenfication").attr("readonly","readonly");}else{$(‘#Woman‘).val(xm);$(‘#Womanidenfication‘).val(zjhm);$("#Woman").attr("readonly","readonly");$("#Womanidenfication").attr("readonly","readonly");}}else{if (parseInt(zjhm.substr(14, 1)) % 2 == 1) { $(‘#Man‘).val(xm);$(‘#Manidenfication‘).val(zjhm);$("#Man").attr("readonly","readonly");$("#Manidenfication").attr("readonly","readonly");}else{$(‘#Woman‘).val(xm);$(‘#Womanidenfication‘).val(zjhm);$("#Woman").attr("readonly","readonly");$("#Womanidenfication").attr("readonly","readonly");}}} 

DangAn 一次js

上一篇:WORD里头的图片如何直接复制到web编辑器


下一篇:Docs-.NET-.NET指南-事件:处理和引发事件