Heim  >  Artikel  >  Web-Frontend  >  Einführung der Verschlüsselung der JS-Formularübermittlungsinformationen

Einführung der Verschlüsselung der JS-Formularübermittlungsinformationen

coldplay.xixi
coldplay.xixinach vorne
2021-03-09 10:20:331782Durchsuche

Einführung der Verschlüsselung der JS-Formularübermittlungsinformationen

Submit Form

<!DOCTYPE html><html lang="en"><head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="md5.js"></script></head><body><form action="#" method="post" >
    <p>
        <span>用户名:</span> <input type="text" id="username" name="username">
    </p>
    <p>
        <span>密码:</span> <input type="password" id="pwd" name="pwd">
    </p><!--      绑定时间 onclick被点击-->
    <button type="submit" onclick="aaa()" >提交</button></form><script>
    function  aaa(){
       var usern=document.getElementById("username");
       var pwd=document.getElementById("pwd");

         console.log(usern)
         console.log(pwd)

       pwd.value=md5(pwd.value);
         console.log(pwd.value);

       
    }</script></body></html>

free Lernempfehlung: javaScript Video Tutorial

optimize Formulare MD5 -Verschlüsselung

<!DOCTYPE html><html lang="en"><head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="md5.js"></script></head><body><!--  onsubmit 绑定一个提交检测函数  true false 将这个结果返回表单 ,使用 onsubmit 接收 onsubmit="return aaa() --><form action="https://home.firefoxchina.cn/" method="post"  onsubmit="return aaa()">
    <p>
        <span>用户名:</span> <input type="text" id="username" name="username">
    </p>
    <p>
        <span>密码:</span> <input type="password" id="pwd" name="pwd">
    </p>

    <input type="hidden" id="md5-password" name="password"><!--      绑定时间 onclick被点击-->
    <button type="submit" >提交</button></form><script>
    function  aaa(){
       var usern=document.getElementById("username");
       var pwd=document.getElementById("pwd");
       var md5=document.getElementById("md5-password")


        md5.value=md5(pwd.value);

        // console.log(usern)
        // console.log(pwd)

        //pwd.value=md5(pwd.value);
        // console.log(pwd.value);

        //可以校验判断表单内容  true 就是通过提交  false 就是组织提交
        return true;
    }</script></body></html>

Wenn Sie die md5.js -Datei benötigen, können Sie private Nachricht an mich, danke, danken Ihnen für Ihre Unterstützung!

Verwandte kostenlose Lernempfehlungen: Javascript (Video)

Das obige ist der detaillierte Inhalt vonEinführung der Verschlüsselung der JS-Formularübermittlungsinformationen. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Stellungnahme:
Dieser Artikel ist reproduziert unter:csdn.net. Bei Verstößen wenden Sie sich bitte an admin@php.cn löschen