2017-01-01 33 views
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;" />

+0

你可以提供你的'form'全HTML – Abood

+0

这是一个无效的代码。表格过早关闭。 –

+0

@PraveenKumar不,它不是。它只是在表单的开始标记中出现错误。我更关心输入名称中的拼写错误,输入样式中的“left”和“top”不做任何事情。 –

回答

相关问题