asp+ajax仿google搜索提示效果代码(4)


obj_div.style.display="block";
removediv();removediv();
}else{
hideajaxdiv();
}
updown_run=true;
ajax_run_ing=false;
li_num=-1;
if(contant=="")value_unexit=temp_value;
}
}
}
ajax_xmlhttp.open("post",url,true);
ajax_xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
ajax_run_ing=true;
ajax_xmlhttp.send("sift_value="+escape(temp_value)); //提交到后台的值*****************************************
}
////////////////////////内容重组///////////////////////
function resetcontant(Fun_contant){
if(Fun_contant==null || Fun_contant=="")return "";
var a=Fun_contant.substring(1,Fun_contant.length-1);
if(Fun_contant==null || Fun_contant=="")return "";
var b=a.split("''");
var c;
var d;
d="<ul>";
for(var i in b){
c=b[i].split(",");
//***************************************************************
d=d+"<li onmouseover=\"overli("+i+");\" onmousedown=\"downli("+i+")\" onmouseup=\"upli("+i+",event)\" onmousemove=\"moveli();\"><span>约"+c[1]+"结果</span>"+c[0]+"</li>";
//***************************************************************
}
d=d+"<li onmousedown=\"input_focus=true;li_down=-1;\" onmouseup=\"li_down=-1\" onmousemove=\"moveli();\"><span><a class=\"shutajaxdiv\" onclick=\"hideajaxdiv();\">关闭</a></span></li>"
d=d+"</ul>";
return d;
}
////////////////////////键盘事件////////////////////////
function keydowndeal(Fun_event){
var keyc=((window.event)?Fun_event.keyCode:Fun_event.which);
if(keyc==13){hideajaxdiv();return false;}
if(keyc==27){
if(obj_div.style.display=="block" && li_num>-1)value_ed=obj_input.value=value_ing;
hideajaxdiv();
return false;
}
if(keyc==40 || keyc==38){
if(div_word==obj_input.value && obj_div.style.display=="none" && obj_div.innerHTML!=""){
obj_div.style.display="block";
removediv();
return false;
}
if(li_num==-1){
if(div_word!=obj_input.value)return false;
}else{
if(div_word!=value_ing)return false;
}
if(updown_run==false || ajax_run_ing==true || obj_div.style.display=="none")return false;
updown_delay=setTimeout("updownli("+keyc+")",time_delayupdown);
updown_run=false;
}
}
////////////////////////方向键移动li////////////////////////
function updownli(Fun_key){
if(!obj_div){return false;}
updown_run=true;
if(li_num==-1){
if(div_word!=obj_input.value){hideajaxdiv();obj_div.innerHTML="";li_num=-1;return false;}
}else{
if(div_word!=value_ing){hideajaxdiv();obj_div.innerHTML="";li_num=-1;return false;}
}
if(updown_run==false)return false;
if(li_num==-1)value_ing=value_ed;
if(Fun_key==40){
if(li_num<obj_div.firstChild.childNodes.length-2){
li_num++;
}else{
li_num=-1;
}
}
if(Fun_key==38){
if(li_num>=0){
li_num--;
}else{
li_num=obj_div.firstChild.childNodes.length-2;

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2168.html