﻿function check() {
    if (document.getElementById("txtname").value == "" || document.getElementById("txtname").value == "请输入用户名") {
        alert("请输入用户名");
        return false;
    }
    if (document.getElementById("txtpassword").value == "" || document.getElementById("txtpassword").value == "请输入登录密码") {
        alert("请输入登录密码");
        return false;
    }
    if (document.getElementById("txtcheckcode").value == "" || document.getElementById("txtcheckcode").value == "请输入验证码") {
        alert("请输入验证码");
        return false;
    }
}

$(document).ready(function () {
    $("#txtname").focus(function () {
        if ($("#txtname").val() == "请输入用户名") {
            $("#txtname").val("");
        }
    });
    $("#txtname").blur(function () {
        if ($("#txtname").val() == "") {
            $("#txtname").val("请输入用户名");
        }
    });

//    $("#txtpassword").focus(function () {
//        if ($("#txtpassword").val() == "请输入登录密码") {
//            $("#txtpassword").val("");
//        }
//    });
//    $("#txtpassword").blur(function () {
//        $("#txtpassword")
//        if ($("#txtpassword").val() == "") {
//            $("#txtpassword").val("请输入登录密码");
//        }
//    });

    $("#txtcheckcode").focus(function () {
        if ($("#txtcheckcode").val() == "请输入验证码") {
            $("#txtcheckcode").val("");
        }
    });
    $("#txtcheckcode").blur(function () {
        if ($("#txtcheckcode").val() == "") {
            $("#txtcheckcode").val("请输入验证码");
        }
    });

});
