JQUERY实现自动提示.ppt
上传人:sy****28 上传时间:2024-09-11 格式:PPT 页数:8 大小:218KB 金币:16 举报 版权申诉
预览加载中,请您耐心等待几秒...

JQUERY实现自动提示.ppt

JQUERY实现自动提示.ppt

预览

在线预览结束,喜欢就下载吧,查找使用更方便

16 金币

下载此文档

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

Jquery实现自动提示页面代码:<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN"><html><head><title>google.html</title><metahttp-equiv="keywords"content="keyword1,keyword2,keyword3"><metahttp-equiv="description"content="thisismypage"><metahttp-equiv="content-type"content="text/html;charset=UTF-8"><scripttype="text/javascript"src="js/jquery-1.3.2.js"></script><scripttype="text/javascript">varline=0;functiondel(){if($("#newDiv")){$("#newDiv").remove();line=0;}}$(document).ready(function(){//文本框失去焦点时层消失$(document.body).click(function(){del();});$(document).keydown(function(){//38上40下13回车if($("#newDiv")){if(event.keyCode==40){$("tabletbodytr").eq(line).css("backgroundColor","blue").css("color","white");$("tabletbodytr").eq(line<0?0:line-1).css("backgroundColor","white").css("color","black");line=(line==$("tabletbodytr").length?0:line+1);}elseif(event.keyCode==38){line=(line==0?$("tabletbodytr").length:line-1);$("tabletbodytr").eq(line).css("backgroundColor","blue").css("color","white");$("tabletbodytr").eq(line>$("tabletbodytr").length?0:line+1).css("backgroundColor","white").css("color","black");}elseif(event.keyCode==13){$("#key").val($("tabletbodytr").eq(line-1).find("td").eq(0).html());del();}}});$("#key").bind("propertychange",function(){del();vartop=$("#key").offset().top;varleft=$("#key").offset().left;varnewDiv=$("<div/>").width($("#key").width()+6).css("position","absolute").css("backgroundColor","white").css("left",left).css("top",top+$("#key").height()+6).css("border","1pxsolidblue").attr("id","newDiv");vartable=$("<tablewidth='100%'/>").attr("cellpadding","0").attr("cellspacing","0");$.post(“jqueryServlet",{key:$("#key").val()},function(xml){$(xml).find("resultsresult").each(function(){varkey=$(this).attr("key");varcount=$(this).attr("count");vartr=$("<tr/>").css("cursor","pointer").mouseout(function(){$(this).css("backgroundColor","white").css("color","black");}).mouseover(function(){$(this