这一行更新了captcha镜像,它也应该清除输入框'captcha‘。
<div id="refresh_button"><a href="#" onclick="refreshimg();return false;"><img src="refresh.gif"/></a></div>
<input type="text" maxlength="6" name="captcha" id="captcha" class="captcha_inputbox" />所以我不得不修改onClick,但我找不到这个,即使用谷歌也找不到。
非常感谢您的帮助
发布于 2012-04-04 05:58:53
您可以使用以下命令清除文本框的值:
document.getElementById('captcha').value = '';或者,如果您使用的是jQuery:
$('#captcha').val('');发布于 2012-04-04 06:00:31
更好的做法是在脚本标记中执行此操作。例如,您可以这样做:
<script type='text/javascript'>
function refreshimg() {
// do the refreshing here
// since your input text has an id of 'captcha'
document.getElementById("captcha").value = "";
return false;
}
</script>然后,在HTML中,您将执行以下操作
<div id="refresh_button"><a href="#" onclick="return refreshimg();"><img src="refresh.gif"/></a></div>
<input type="text" maxlength="6" name="captcha" id="captcha" class="captcha_inputbox" />https://stackoverflow.com/questions/10001956
复制相似问题