<div class="div_c mobi_top">
    <h4>密码修改</h4>
    <table class="table">
        <tr>

            <td><input type="password" name="password_o" id="password_o" value="" placeholder="原始密码" style
                ="width: 100%"></td>
        </tr>
        <tr>

            <td><input type="password" name="password_new" id="password_new" value="" placeholder="新密码" style
                ="width: 100%"></td>
        </tr>
        <tr>
            <td><input type="password" name="password_new_2" id="password_new_2" value="" placeholder="重复新密码" style
                ="width: 100%"></td>
        </tr>
        <tr>

            <td><input type="submit" value="保存" onclick="change_password()"  style="width: 100%; background-color: #00a0e9" class="btn"></td>
        </tr>
    </table>
</div>
<script language="javascript">
    function change_password() {
        password_o = $("#password_o").val();
        password_new = $("#password_new").val();
        password_new_2 = $("#password_new_2").val();

        $("em").hide();

        if (password_o == '') {
            $("#password_o").after('<em class=warning>请输入原始密码</em>');
            $("#password_o").focus();
            return false;
        }

        if (password_new == '') {
            $("#password_new").after('<em class=warning>请输入新密码</em>');
            $("#password_new").focus();
            return false;
        }

        if (password_new_2 == '') {
            $("#password_new_2").after('<em class=warning>请重复输入新密码</em>');
            $("#password_new_2").focus();
            return false;
        }

        if (password_new != password_new_2) {
            $("#password_new_2").after('<em class=warning>两次密码输入不一致，请重新输入</em>');
            $("#password_new_2").focus();
            return false;
        }

        url = "index.php?c=ajax&action=my_setting_password_edit&password_new=" + password_new + "&pwd_o=" + password_o;
        $.get(url, function (data) {
            tips("修改中..");
            if (data == '1') {
                alert("密码修改成功");
                location.href = 'index.php?c=home&action=my_setting_password';
            }
            else {
                $("#password_o").after('<em class=warning>原始密码不正确</em>');
                $("#password_o").focus();
                return false;
            }
        })
    }
</script>