gpt4 book ai didi

javascript - jquery on click
转载 作者:行者123 更新时间:2023-12-03 10:25:13 24 4
gpt4 key购买 nike

我尝试了几个例子,但没有任何效果。但我收到了警报,所以我真的不明白。当我的表单未发送任何数据时,为什么会收到警报?如果我使用输入,一切正常。我也尝试将脚本放入 js 文件中,但结果仍然相同。

<form action="includes/process_login.php" method="post" name="login_form">  
<li class='mainMenu menuDeroulant' id='btnGames'>
Jeu <img class='arrow' src="Styles/Images/triangle.png" alt="">
</li>
<li class='mainMenu' id='btnReward'>Récompenses <img class='arrow' src="Styles/Images/triangle.png" alt=""></li>
<input class='loginInfo' type="text" placeholder='Username' name="email">
<input class='loginInfo' type="password" placeholder='Password' name="password" id="password">
<li id='btnJouer' class='mainMenu'>JOUER</li>
<li class='mainMenu' id='btnPlayer'>Player <img class='arrow' src="Styles/Images/triangle.png" alt=""></li>
<li id='btnAdmin' class='mainMenu menuDeroulant'>Admin <img class='arrow' src="Styles/Images/triangle.png" alt=""></li>
<li class="mainMenu loginInfo"><img src="Styles/Images/facebookBtn.png" alt=""></li>
<li class='mainMenu loginInfo'><a id="myanchorid" href="#">Connexion</a></li>
<li class='mainMenu loginInfo'>Inscription</li>
<a href="indexEN.php"><li class='mainMenu'>EN</li></a>
</form>

<script>
$(function(){
function yourfunction(event) {
alert('some anchor clicked');
formhash(this.form, this.form.password);
return false;
}
$('#myanchorid').click(yourfunction);
$('a.anchorclass').click(yourfunction);
$('#anchorlist > a').click(yourfunction);
});
</script>

我的js文件:

function formhash(form, password) {
// Create a new element input, this will be our hashed password field.

var p = document.createElement("input");

// Add the new element to our form.
form.appendChild(p);
p.name = "p";
p.type = "hidden";
p.value = hex_sha512(password.value);

// Make sure the plaintext password doesn't get sent.
password.value = "";

// Finally submit the form.
form.submit();
}

最佳答案

关于javascript - jquery on click <a 标签不适用于我的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29434394/

24 4 0

Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com