<head>
<title></title>
<style type="text/css">
#txtKey{ width:300px;}
</style>
<link href="jquery.autocomplete.css" rel="stylesheet" type="text/css" />
<script src="Jquery1.7.js" type="text/javascript"></script>
<script src="jquery.autocomplete.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
var array = ['asp.net', 'asp.net mvc', 'wcf', 'wpf', 'win8', 'windows phone', '张东', '张熙', '张亚飞'];
$('#txtKey').autocomplete(array).result(function (event, data) {
//$('#Text1').val(data);
window.location.href = 'http://www.baidu.com/s?wd=' + data + '&rsv_bp=0&ch=&tn=baidu&bar=&rsv_spt=3&ie=utf-8&rsv_sug3=6&rsv_sug=0&rsv_sug1=3&rsv_sug4=229&inputT=1458';
});
})
</script>
</head>
<body>
<input id="txtKey" type="text" /><input id="Button1" type="button" value="百度一下" />
<input id="Text1" type="text" />
</body>
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)