我整整一周都无法解决验证码问题。我在谷歌找到了简单的数学验证码,现在我需要组合两个按钮:检查(验证码)和一个按钮中的发送按钮。现在,当我尝试在验证码上正确回答后发送信件时,我看到了失败错误。任何建议将不胜感激!
<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("What is "+ 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 window.open('','_top');
return alert(false);
}
</script>
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4>Отправьте сообщение</h4>
</div>
<div class="modal-body">
<form class="contact2" name="contact">
<label class="label" for="name">Имя</label><br>
<input type="text" name="name" class="input-xlarge"><br>
<label class="label" for="email">E-mail</label><br>
<input type="email" name="email" class="input-xlarge"><br>
<label class="label" for="message">Сообщение</label><br>
<textarea name="message" class="input-xlarge"></textarea>
</form>
</div>
<div class="modal-footer">
<script type="text/javascript">DrawBotBoot()</script>
<input id="Button1" type="button" value="Check" onclick="ValidBotBoot();"/>
<input class="btn btn-warning" type="submit" value="Отправить" id="submit2">
<a href="#" class="btn btn-danger" data-dismiss="modal">Закрыть</a>
</div>