これはおそらく非常に基本的な JavaScript の質問ですが、その方法を知るにはまだ十分ではありません。
ユーザーが 2 つの数字を追加する必要がある基本的なスパム対策ソリューションの呼び出しが成功した後、jQuery のフォーム バリデーターを使用してフォームを続行するにはどうすればよいですか?
<html>
<head>
<script type="text/javascript">
var a = Math.ceil(Math.random() * 10);
var b = Math.ceil(Math.random() * 10);
var c = a + b
function DrawBotBoot()
{
document.write("Résultat de "+ a + " + " + b +"? ");
document.write("<input id='BotBootInput' type='text' maxlength='2' size='2'/>");
}
function ValidBotBoot(){
var d = document.getElementById('BotBootInput').value;
if (d == c) return true;
return false;
}
</script>
<script>
//Used by jQuery to validate all form fields
$(document).ready(function(){
$("#myform").validate();
</script>
</head>
<body>
<form action="send.php" method="post" id="myform">
<input type="text" maxlength="25" id="name" name="name" class="required"/>
Are you human?<br />
<script type="text/javascript">DrawBotBoot()</script>
<input id="Button1" type="button" value="Send" onclick="alert(ValidBotBoot());"/>
</form>
</body>
</html>
ありがとうございました。