1. 程式人生 > >做webform註意事項 閏年日期

做webform註意事項 閏年日期

改密 tel reat 語句 class 都是 option erro 是否一致

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 == "2") { if (this.value % 4 == 0) { day.options.length = 0; for (var i = 1; i < 30; i++) { var op = document.createElement("option"); op.value
= i; op.innerHTML = i; day.appendChild(op); } } else { day.options.length = 0; for (var i = 1; i < 29; i++) { var op = document.createElement("option"); op.value
= i; op.innerHTML = i; day.appendChild(op); } } } } document.getElementById("Dr_Month").onchange = function () { if (this.value == "2") { if (year.value % 4 == 0) { day.options.length = 0; for (var i = 1; i < 30; i++) { var op = document.createElement("option"); op.value = i; op.innerHTML = i; day.appendChild(op); } } else { day.options.length = 0; for (var i = 1; i < 29; i++) { var op = document.createElement("option"); op.value = i; op.innerHTML = i; day.appendChild(op); } } } else if (this.value == "1" || this.value == "3" || this.value == "5" || this.value == "7" || this.value == "8" || this.value == "10" || this.value == "12") { day.options.length = 0; for (var i = 1; i < 32; i++) { var op = document.createElement("option"); op.value = i; op.innerHTML = i; day.appendChild(op); } } else { day.options.length = 0; for (var i = 1; i < 31; i++) { var op = document.createElement("option"); op.value = i; op.innerHTML = i; day.appendChild(op); } } }


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;
        }
    }

做webform註意事項 閏年日期