【发布时间】:2018-08-05 09:01:09
【问题描述】:
这可能是一个愚蠢的问题,所以很抱歉我是网络开发的新手。我正在尝试编写一个页面,以便在单击 reCAPTCHA 之前禁用搜索按钮(我知道这可以被垃圾邮件发送者规避,所以这不是我关心的问题)。我目前的设置方式是这样的:
<div id="search_area">
<script type="text/javascript">
function enableButton() {
document.getElementById('search_submit').disabled = false;
}
</script>
<input id="ch_search" size="50" type="text"/><button class="search_button" id="ch_search_submit" disabled="true">Search</button>
<script src='https://www.google.com/recaptcha/api.js'></script>
<div class="g-recaptcha" data-sitekey="XXXXXXXXXX" data-callback = "enableButton()" ></div>
</div>
目前仅用于初始测试,我没有 php 验证检查表单。当我检查文本框并变为绿色时,它没有像我想象的那样启用搜索按钮。谁能指出我为什么这不起作用的正确方向?感谢您对成为新手的任何帮助。
【问题讨论】:
标签: javascript html recaptcha captcha