代码如下: 复主代码 代码如下: <%@ Page Language="C# " AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %> 无标题页 <!-- <BR>.mouseEnter <BR>{ <BR>배경색: 노란색; <BR>} <br><br>--> .mouseEnter <br>{ <br>배경색: 노란색; <br>} <br> <!-- <br><br>$(function(){ <BR>$("#result").css("position"," 절대"); <BR>var offset =$("#TextBox1").offset(); <BR>$("#result").css({왼쪽: offset.left "px",top: offset.top $("#TextBox1").height() "px"}) <br><br>}); <BR>// --> <본문> 테이블> <!-- <BR>var size = 0; //每次真实取到的数据条目数(最大10) <BR>var index = -1 ;//计算keydown事件:td索引; <br><br>function setTdEvent(){//为生成的TD设置事件 <BR>//点击效果 <BR>$("#mytable>tr>td").click(function(){ <br>$("#TextBox1").val($(this).text( )) <br>}); <br>//选择高亮效果 <br>$("#mytable>tr >td").hover(function(){ <br>$(this).addClass("mouseEnter"); <br>} ,function(){ <br>$(this).removeClass("mouseEnter") <br>}); <br>} <br><br><br>function setTD(text){ <br>//$("tr:even").css("BackgroundColor","blue"); <br>"<tr><td style='border: 0px none #FFFFFF;width:100%'>"를 반환합니다. 텍스트 "</td></tr>"; <br>} <br><br>function setTable(msg) <br>{ <br>var tbody = $("#mytable"); <br>var texts = msg.split(";"); <br>var str =""; <br>크기 = texts.length; <br>for(var i=0;i<texts.length;i ) <BR>{ <BR>str = setTD(texts[i]); <BR>} <BR>tbody.html(str); <BR>setTdEvent() <BR>$("#div1").show("fast"); <BR>} <br><br>function setKeyDown(str) <BR>{ <BR>$("#mytable>tr>td:eq(" index ")").removeClass("mouseEnter"); <br>if(str == " ") <br>{ <br><br>index = (index) % size; <br>} <br>else if("-") <br>{ <br>index =(--index size) % size; <br>} <br>시도해 보세요{ <br>$("#mytable>tr>td:eq(" index ")").addClass("mouseEnter"); <br>}catch(e){ <br>alert(e); <br>} <br><br>} <br><br>$(function(){ <br><br>$("#TextBox1").bind("propertychange",function(){ <br> $("#div1").hide("fast").html(""); <br>index = -1; $.ajax({ <br>type: "POST", <br>url : "Suggest.ashx", <br>데이터: "word=" $("#TextBox1").val() "&time=" new Date().toLocaleTimeString(), <br>성공: function(msg){ <br>setTable( msg ); <br>} <br>}); <br>}) <br><br>$("#TextBox1").bind("keydown",function(event){ <br>if( event.keyCode == 38 ) <br>{ <br><br>setKeyDown("-") <br>} <br>else if(event.keyCode == 40) <br>{ <br>setKeyDown(" "); <br>} <br>else if(event.keyCode == 13 && index != -1) <br>{ <br><br>$("#TextBox1").val ( $("#mytable>tr>td:eq(" index ")").text()) <br>} <br>}); <br>// -->