像文本框一样的Google搜索

am want to create a text box like google search text box...

What i have tried is When entered a character, using AJAX the words starting with that word will be displayed in a div its working fine but i want that it should work exactly like google search box.. Now the arrow keys are not working only by clicking the text will be selected

MY CODE

<style>
#resultDiv {
width:154px;
position:absolute;
left:121px;
top:30px;
}

p {
padding:0px;
margin:0px;
}
#resultDiv p:hover {
background-color:#999;
}
</style>
<script type="text/javascript">
$(document).ready(function(e) {
$('#resultDiv p').live('click',function(){
    var value = $(this).text();
    $('#word').val(value);
});
});
</script>

</head>

<body>
<form action="" method="post">
<label>Enter Your Word </label><input type="text" id="word"/>
<div id="resultDiv"></div>
</form>

<script>
// prepare the form when the DOM is ready 
$(document).ready(function() { 
$('#word').keyup(function(e) {
$.ajax({
        type: "POST",
        url: "googleDropSearch.php",
        data: "word="+this.value,
        success: function(msg){
            $('#resultDiv').html(msg);
            $('#resultDiv').css('border-left','1px solid #ccc').css('border-right','1px solid #ccc').css('border-bottom','1px solid #ccc');
        }
    });
});
});

</script>

</body>
</html>

ACTION PAGE

<?php
$connection = mysql_connect('localhost','root','') or die("ERROR".mysql_error());
$connection = mysql_select_db('ajax',$connection) or die("ERROR".mysql_error());

if(!empty($_POST)):
if(isset($_POST['word']) && $_POST['word'] != ''):
/****************
Sanitize the data
***************/
$key =$_POST['word'];
$query = mysql_query("SELECT county FROM fl_counties WHERE county LIKE '$key%';");

 $rows = mysql_num_rows($query);
 if($rows != 0):
while($result = mysql_fetch_array($query)):

echo "<p>".$result[0]."</p>";
endwhile;
endif;//rows > 0


endif;//county not sent

endif;


?>

There is one useful plugin available in jquery.

Jquery Autocomplete

There is simple demo available you just have to pass an array to it.

Hope this would work for you.