我有很多通过单击显式<input type="image">
键或回车键提交的表单。
使用的代码是:
<input width="62" type="image" height="22" border="0" onclick="flipSearchButton()" alt="Search" tabindex="9" src="/images/button-search.gif">
这些表格现在已经重新开发,代码看起来像这样
<a onclick="javascript:flipSearchButton();" class="button blue right" tabindex="9" href="javascript: submitform("main")">Search</a>
但是,自从更改后,单击回车键时不会提交表单。
如何使输入按钮提交表单?
表单的输入和清除按钮的html部分是:
<div class="inline">
<a class="icon blue left" onClick="javascript:resetForm();">Clear</a>
</div>
<div id="search_clickable">
<a tabindex="14" class="button blue right" href="javascript:flipSearchButton();submitform('main')">Search</a>
</div>
<div id="search_unclickable" class="disp_none;">
<a class="button blue right" href="">Searching...</a>
</div>
<script type="text/javascript">
function resetForm() {
var formObj = document.main;
formObj.subCategory.value = '';
formObj.surname.value = '';
formObj.includeSurnameVariants.checked = false;
formObj.forenames.value = '';
formObj.forenames.focus();
formObj.includeForenamesVariants.checked = true;
formObj.eventYear.value = '';
formObj.eventYearTolerance[3].selected = true;
formObj.county.value = '';
}
$(document).ready(function() {
document.main.forenames.focus();
});
</script>