我在HTML
Live Search的工作,我工作得很好,但我得到了一個小問題, 這裏是我的指數代碼:清晰的列表中向下的HTML
<form id="quick-search" action="livesearch.php" method="GET" >
<p>
Search:
<input id="qsearch" type="text" name="qsearch" onkeyup="liveSearch()" />
<input type="submit" />
</p>
<div id="searchResults">
</div>
</form>
這裏是我的js代碼:
function liveSearch()
{
var url = "livesearch.php";
var s = document.getElementById('qsearch').value;
http.open("POST", "livesearch.php?qsearch="+s, true);
http.onreadystatechange = function()
{
if(http.readyState == 4 && http.status == 200)
{
document.getElementById('searchResults').innerHTML = 'Suggestions are as follow'+http.responseText;
//alert(http.responseText);
}
}
http.send();
}
我正確地得到結果,但是,當我清空完整的輸入框,然後我正在從數據庫中完整列表框中,在空的輸入框,我想要清除列表框
是問題缺失的最後一部分? –
對不起,請... –
有沒有我們可以查看當前版本的版本? – Ladineko