首页 > 代码库 > webfrom 做项目的注意事项

webfrom 做项目的注意事项

1、展示细节

如男女显示问题 不能显示true   false  时间转换成中文  民族显示汉字  不能直接显示代码
2、用户名重复验证

从数据库中查询验证
4、日期判断

判断年份有点问题

 
 var year = document.getElementById("Dr_Year");
    var mon = document.getElementById("Dr_Month");
    var day = document.getElementById("Dr_Day");
    document.getElementById("Dr_Year").onchange = function () {
        
        if (mon.value =http://www.mamicode.com/="2")
        {
            if (this.value % 4 == 0)
            {
                day.options.length = 0;
                for (var i = 1; i < 30; i++)
                {
                    var op = document.createElement("option");
                    op.value = http://www.mamicode.com/i;"option");
                    op.value = http://www.mamicode.com/i;"Dr_Month").onchange = function () {
        
        if (this.value =http://www.mamicode.com/="2") {
            if (year.value % 4 == 0) {
                day.options.length = 0;
                for (var i = 1; i < 30; i++) {
                    var op = document.createElement("option");
                    op.value = http://www.mamicode.com/i;"option");
                    op.value = i;
                    op.innerHTML = i;
                    day.appendChild(op);
                }
            }
        }
        else if (this.value =http://www.mamicode.com/="1" || this.value =http://www.mamicode.com/="3" || this.value =http://www.mamicode.com/="5" || this.value =http://www.mamicode.com/="7" || this.value =http://www.mamicode.com/="8" || this.value =http://www.mamicode.com/="10" || this.value =http://www.mamicode.com/="12") {
            day.options.length = 0;
            for (var i = 1; i < 32; i++) {
                var op = document.createElement("option");
                op.value = http://www.mamicode.com/i;"option");
                op.value = http://www.mamicode.com/i;>
 

 


5、修改页面无法提交


6、编辑时,如密码不填,则保留原有密码

一般都是单独改密码    统一改的时候在修改方法里面加一个判断 

执行语句 如果密码为空则不修改密码 

密码不为空在修改

 

 

用js判断密码是否一致

 
var p1 = document.getElementById("TextBox2");
    var p2 = document.getElementById("TextBox3");

    p1.onkeyup = function () { pwdisok(p1, p2); }
    p2.onkeyup = function () { pwdisok(p1, p2); }

    function pwdisok(pwd1, pwd2) {
        if (pwd1.value != pwd2.value) {
            document.getElementById("pwd_error").innerText = "两次密码不一致!";
            document.getElementById("pwd_error").style.color = "red";
            pwdok = false;
        }
        else {
            document.getElementById("pwd_error").innerText = "正确!";
            document.getElementById("pwd_error").style.color = "green";
            pwdok = true;
        }
    }

webfrom 做项目的注意事项