代幣如下: 复制代 代幣如下: <%@ 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({left: offset.left "px",top: offset.top $("#TextBox1").height() "px"}); <br>// --> <!-- <BR>var size = 0; //次回真に取得したデータ条項(最大10) <BR>varindex = -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>function setTD(text){ <br>//$("tr:even").css("backgroundColor","blue"); <br>return "<tr><td style='border: 0px none #FFFFFF;width:100%'>" テキスト "</td></tr>"; <br>} <br><br>function setTable(msg) <br>{ <br>var tbody = $("#mytable"); <br>var text = msg.split(";"); <br>var str =""; <br>サイズ = テキスト.長さ; <br>for(var i=0;i<texts.length>{ <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) % サイズ; <br>} <br>else if("-") <br>{ <br>index =(--index size) % size; <br>} <br>try{ <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; <br>$.ajax({ <br>type: "POST", <br>url : "Suggest.ashx", <br>data: "word=" $("#TextBox1").val() "&time=" new Date().toLocaleTimeString(), <br>success: function(msg){ <br>setTable( msg ); <br>} <br>}); <br><br>$("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>// -->