欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

jquery搜索提示,jquery下拉框索引

求助Jquery Autocomplete 如何動(dòng)態(tài)加載數(shù)據(jù),類(lèi)似百度的搜索提示

自己解決了,前臺(tái)代碼:

創(chuàng)新互聯(lián)公司是專(zhuān)業(yè)的光明網(wǎng)站建設(shè)公司,光明接單;提供網(wǎng)站設(shè)計(jì)制作、成都做網(wǎng)站,網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專(zhuān)業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行光明網(wǎng)站開(kāi)發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專(zhuān)業(yè)做搜索引擎喜愛(ài)的網(wǎng)站,專(zhuān)業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!

1 link href="AutoLib/jquery.autocomplete.css" rel="stylesheet" type="text/css" /

2 script src="lib/jquery-1.4.1.min.js" type="text/javascript"/script

3 script src="AutoLib/jquery.autocomplete.min.js" type="text/javascript"/script

4 script type="text/javascript" src="lib/localdata.js"/script

5

6 script type="text/javascript"

7 $().ready(function () {

8 //靜態(tài)填充

9 $("#TxtJsion").focus().autocomplete(emails, {

10 minChars: 0,

11 width: 310,

12 max: 0,

13 matchContains: true,

14 autoFill: false,

15 formatItem: function (row, i, max) {

16 //顯示的值

17 return i + "/" + max + ": \"" + row.name + "\" [" + row.to + "]";

18 },

19 formatMatch: function (row, i, max) {

20 //查找匹配的值

21 return row.name + " " + row.to;

22 },

23 formatResult: function (row) {

24 //選中后的值

25 return row.to;

26 }

27 });

28

29 });//初始化結(jié)束

30

31 //動(dòng)態(tài)填充

32 function AutoFillKey() {

33 var keyWords = $("#%=TxtAuto.ClientID%").val();

34

35 //改變綁定的內(nèi)容

36 if (keyWords.length == 1 keyWords != $("#TxtKey").val()) {

37 $("#TxtKey").val(keyWords);

38 $("#TxtAuto").unautocomplete();

39

40 $.ajax({

41 type: "POST",

42 url: "ServerData.ashx",

43 data: { "KW": keyWords },

44 dataType: "json",

45 timeout: 2000,

46 error: function (data) {

47 alert("請(qǐng)求失敗:" + data.responseText);

48 },

49 success: function (data) {

50 AutoCompleteKey(data);

51 }

52 });

53

54 } //end if

55 }

56

57 function AutoCompleteKey(data) {

58 //填充開(kāi)始

59 $("#%=TxtAuto.ClientID%").autocomplete(data, {

60 minChars: 0,

61 width: 640,

62 autoFill: false,

63 matchContains: true,

64 selectFirst: false,

65 scrollHeight: 220,

66

67 scroll: true,

68 formatItem: function (row, i, max) {

69 //顯示的值

70 return i + "/" + max + ": \"" + row.name + "\" [" + row.to + "]";

71 },

72 formatMatch: function (row, i, max) {

73 //查找匹配的值

74 return row.name + " " + row.to;

75 },

76 formatResult: function (row) {

77 //選中后的值

78 return row.to;

79 }

80 });

81 //填充結(jié)束

82 }

83

84 /script

85 /head

86 body

87 form id="form1" runat="server" method="post"

88 div

89 p靜態(tài)填充input type="text" id="TxtJsion" //p

90

91 p動(dòng)態(tài)填充

92 input type="text" id="TxtAuto" onkeyup="AutoFillKey();" runat="server" /

93 input type="hidden" id="TxtKey" value="" runat="server" /

94 /p

95 /div

96 /form

97 /body

98 /html

后臺(tái)代碼:

1 using System;

2 using System.Collections.Generic;

3 using System.Linq;

4 using System.Web;

5 using System.Web.Script.Serialization;

6 using System.Text;

7 using System.Web.Services;

8

9 namespace AutocompleteWeb

10 {

11 /// summary

12 /// ServerData 的摘要說(shuō)明

13 /// /summary

14 [WebService(Namespace = ]

15 [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

16 public class ServerData : IHttpHandler

17 {

18

19 public void ProcessRequest(HttpContext context)

20 {

21 //GET方式

22 //context.Response.ContentType = "text/plain";

23 //string keyword = context.Request.QueryString["KW"];

24 //if (keyword != null)

25 //{

26 // 通過(guò)JavaScriptSerializer對(duì)象的Serialize序列化為["value1","value2",...]的字符串

27 //JavaScriptSerializer serializer = new JavaScriptSerializer();

28 //string jsonString = serializer.Serialize(GetProvinceCitys(keyword));

29 //context.Response.Write(jsonString); // 返回客戶(hù)端json格式數(shù)據(jù)

30 //}

31

32 //POST方式

33 context.Response.ContentType = "application/json";

34 string keyStr = "";

35 if (context.Request["KW"] != null)

36 {

37 keyStr = context.Request["KW"].ToString();

38 }

39 ResponseJsionStr(context, GetProvinceCitys(keyStr));

40 }

41

42

43 /// summary

44 /// qinjue 2011-09-21

45 /// 返回jsion

46 /// /summary

47 private void ResponseJsionStr(HttpContext context, string strJsion)

48 {

49 context.Response.Clear();

50 context.Response.ClearContent();

51 context.Response.Cache.SetNoStore();

52 context.Response.ContentType = "application/json";

53 context.Response.ContentEncoding = System.Text.Encoding.UTF8;

54 context.Response.Write(strJsion);

55 context.Response.End();

56 }

57

58 public string GetProvinceCitys(string KW)

59 {

60 StringBuilder cytySB = new StringBuilder();

61 cytySB.Append("[");

62 cytySB.Append("{\"name\":\"AACCASF東城區(qū)\",\"to\":\"11001\"},");

63 cytySB.Append("{\"name\":\"AACSAWE西城區(qū)\",\"to\":\"11002\"},");

64 cytySB.Append("{\"name\":\"AACAER海淀區(qū)\",\"to\":\"11003\"}");

65 cytySB.Append("]");

66 return cytySB.ToString();

67 }

68

69 public bool IsReusable

70 {

71 get

72 {

73 return false;

74 }

75 }

76 }

77 }

jquery ajax 獲取百度搜索提示

這是jsonp獲取數(shù)據(jù),將數(shù)據(jù)傳遞給了window.baidu.sug這個(gè)方法,所以,你自己創(chuàng)建這么一個(gè)函數(shù),參數(shù)是個(gè)json對(duì)象,對(duì)數(shù)據(jù)如何操作,你就寫(xiě)在函數(shù)里面,(json如何用,百度)然后用eval或者其他的方式解析你得到的字符串,它就會(huì)自動(dòng)調(diào)用你的函數(shù)。

jquery類(lèi)似百度搜索框輸入文字后顯示提示問(wèn)題?

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

html

head

titlecheckbox/title

script src="js/jquery-1.3.2.js" type="text/javascript"/script

script src="js/1.js" type="text/javascript"/script

/head

body

table id="table1"

tr

tdinput type="checkbox" value="1"/1/td

td id="k_1"input type="text" name="student" id="s_1" readonly="true"http://td

/tr

tr

tdinput type="checkbox" value="2"/2/td

td id="k_2"input type="text" name="student" id="s_2" readonly="true"http://td

/tr

tr

tdinput type="checkbox" value="3"/3/td

td id="k_3"input type="text" name="student" id="s_3" readonly="true"http://td

/tr

tr

tdinput type="checkbox" value="4"/4/td

td id="k_4"input type="text" name="student" id="s_4" readonly="true"http://td

/tr

/table

/body

/html

-------------------------------------------------------------

$(document).ready(function() {

$("td[id^='k_']").hide();

var check = $(":checkbox"); //得到所有被選中的checkbox

var actor_config; //定義變量

check.each(function(i){

actor_config = $(this);

actor_config.click(

function(){

if($(this).attr("checked")==true){

$("#k_"+$(this).val()).show();

}else{

$("#k_"+$(this).val()).hide();

}

}

);

});

});

當(dāng)前標(biāo)題:jquery搜索提示,jquery下拉框索引
URL鏈接:http://chinadenli.net/article10/dsgsego.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站小程序開(kāi)發(fā)網(wǎng)站排名自適應(yīng)網(wǎng)站服務(wù)器托管品牌網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

小程序開(kāi)發(fā)