javaScript


前端密码md5加密

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--cdn引入md5-->
    <script src="https://cdn.bootcdn.net/ajax/libs/blueimp-md5/2.1.0/js/md5.min.js"></script>
</head>
<body>

<form action="https://www.baidu.com/" method="post" onsubmit="return aaa()">
    <p>
        <span>用户名:</span></span><input type="text" id="username"name="username">
    </p>

    <p>
        <span>密码:</span>
        <input type="password"id="input-password">
    </p>

    <input type="hidden"id="md5-password"name="password">

    <button type="submit">提交</button>
</form>

<script>
    function aaa() {
        alert(1);
        var uname = document.getElementById('username');
        var pwd = document.getElementById('input-password');
        var md5_pwd = document.getElementById('md5-password');

        md5_pwd.value = md5(pwd.value);
        return true;

    }
</script>

</body>
</html>

jQuery

jQuery API中文文档
选择器$(selector).action()

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery-3.6.0.js"></script>
</head>
<body>

<a href="" id="test-jquery">点我</a>

<script>

    $('#test-jquery').click(function (){
        alert('hello,jQuery');
    })
</script>

</body>
</html>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ca1m4n

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值