0
我已經使這個搜索框,但你必須按兩次輸入搜索,任何幫助?必須按兩次輸入才能搜索
<script type="text/javascript">
document.getElementById('frmSearch').onsubmit = function() {
window.location = 'http://www.google.com/search?q= ' + document.getElementById('txtSearch').value;
return false;
}
</script>
<form id="frmSearch" class="search2" method="get" action="default.html" />
<input class="search2" id="txtSearch" type="text" name="serach_bar" onclick="myFunction()" placeholder="Search..." size="31" maxlength="500"
value="" style="left: 500px; top: 153px; width: 293px; height: 26px;" />
你可以提供你的'form'全HTML – Abood
這是一個無效的代碼。表格過早關閉。 –
@PraveenKumar不,它不是。它只是在表單的開始標記中出現錯誤。我更關心輸入名稱中的拼寫錯誤,輸入樣式中的「left」和「top」不做任何事情。 –