autocomplete插件
<script type="text/javascript">
function lookup(inputString) {
if(inputString.length == 0) {
// Hide the suggestion box.
$('#suggestions').hide();
} else {
$.post("rpc.php", {queryString: ""+inputString+""}, function(data){
if(data.length >0) {
$('#suggestions').show();
$('#autoSuggestionsList').html(data);
}
});
}
} // lookup

function fill(thisValue) {
$('#inputString').val(thisValue);
setTimeout("$('#suggestions').hide();", 200);
}
</script><?php


$db = new mysqli('localhost', 'root' ,'password', 'Data');

if(!$db) {

echo 'ERROR: Could not connect to the database.';
} else {

if(isset($_POST['queryString'])) {
$queryString = $db->real_escape_string($_POST['queryString']);
                        alert($quryString);



if(strlen($queryString) >0) {


$query = $db->query("SELECT id,value FROM countries WHERE value LIKE '$queryString%' LIMIT 10");
if($query) {

while ($result = $query ->fetch_object()) {

          echo '<li onClick="fill(\''.$result->value.'\');">'.$result->value.'</li>';
          }
} else {
echo 'ERROR: There was a problem with the query.';
}
} else {


} else {
echo 'There should be no direct access to this script!';
}
}
?>
<form>
<div>
Type your county:
<br />
<input type="text" size="30" value="" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" />
</div>

<div class="suggestionsBox" id="suggestions" style="display: none;">
<img src="upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
<div class="suggestionList" id="autoSuggestionsList">
&nbsp;
</div>
</div>
</form>我想使用是textbox数组(多个文本框),怎样修改可以做到autocomplete。
如上面的<input type="text" size="30" value="" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" />
我改为php页面for($i=0;$i<2;$i++){
<input type="text" size="30" value="" id="inputString[$i][0]" onkeyup="lookup(this.value);" onblur="fill();" />
}
它们怎样自动提示哦??
麻烦各位高手教教小弟不胜感激!!!