.仿Google自动提示SearchSuggess .仿Google的搜索下拉框
1.suggest.js 复制代码保存为suggest.js在你需要的页面引用就行了
//建立跨浏览器的xmlHttp对象引用
var xmlHttp;
var k=-1;
var success;
try
{
xmlHttp=new XMLHttpRequest();
success= true;
}
catch(e)
{
var XMLHTTP_IDS = new Array(''MSXML2.XMLHTTP.5.0'',''MSXML2.XMLHTTP.4.0'',''MSXML2.XMLHTTP.3.0'',''MSXML2.XMLHTTP'',''Microsoft.XMLHTTP'' );
var success = false;
for(var i=0;i<XMLHTTP_IDS.length&&!success;i++)
{
try {
xmlHttp = new ActiveXObject(XMLHTTP_IDS[i]);
success = true;
}
catch (e) {
success = false;
}
}
if (!success) {
throw new Error(''Unable to create XMLHttpRequest.'');
}
}
//得到页面使用的引用变量
function initVars() {
inputField = document.getElementById("FrmChangshang");
nameTable = document.getElementById("name_table");
completeDiv = document.getElementById("popup");
nameTableBody = document.getElementById("name_table_body");
document.getElementById("popup").style.display="block";
}
//ajax前台触发函数
function findNames(event) {
var keyc=(window.navigator.appName=="Micro |