jQueryʵÏÖ¶¯Ì¬ËÑË÷ÏÔʾ¹¦ÄÜ
±¾°¸Àý²ÉÓÃjQueryʵÏÖ¶¯Ì¬ËÑË÷ÏÔʾ¹¦ÄÜ£¬Ö»ÒªÊäÈëÖµ¾ÍÄÜÁ¢¿Ì¶¯Ì¬ÏÔʾÊý¾Ý£¬²»Í¬ÓÚ³£¹æ²éѯ·½·¨¡£
Ä£ÄâЧ¹ûÈçÏ£º
¡¢ 2¡¢
<%@ page language="java" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>struts2</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.4.1.js"></script> <script type="text/javascript"> //Êý¾ÝÔ´£¬jsonµÄ¸ñʽ. var user=[{"id": 1, "name": "ÕÅÈý","age":"25"}, {"id": 2, "name": "ÀîËÄ","age":"35"}, {"id": 3, "name": "ÍõÎå","age":"20"}, {"id": 4, "name": "ÀÏÍõ","age":"20"}, {"id": 5, "name": "ÀÏÕÅ","age":"25"}, {"id": 6, "name": "ÀîËÄ","age":"35"}, {"id": 7, "name": "ÍõÎå","age":"20"}, {"id": 8, "name": "ÀÏÍõ","age":"20"}, {"id": 9, "name": "abc","age":"25"}, {"id": 10, "name": "ÀîbËÄ","age":"35"}, {"id": 11, "name": "125","age":"20"}, {"id": 12, "name": "246","age":"20"}, {"id": 13, "name": "ÕÅÈý","age":"25"}, {"id": 14, "name": "ÀîËÄ","age":"35"}, {"id": 15, "name": "ÍõÎå","age":"20"}, {"id": 16, "name": "ÀÏÍõ","age":"20"}, {"id": 17, "name": "ÕÅÈý","age":"25"}, {"id": 18, "name": "ÀîËÄ","age":"35"}, {"id": 19, "name": "ÍõÎå","age":"20"}, {"id": 20, "name": "ÀÏÍõ","age":"20"}]; $(document).ready(function(){ var seach=$("#seach"); seach.keyup(function(event){ //var keyEvent=event || window.event; //var keyCode=keyEvent.keyCode; // Êý×Ö¼ü£º48-57 // ×Öĸ¼ü£º65-90 // ɾ³ý¼ü£º8 // ºóɾ³ý¼ü£º46 // Í˸ñ¼ü£º32 // enter¼ü£º13 //if((keyCode>=48&&keyCode<=57)||(keyCode>=65&&keyCode<=90)||keyCode==8||keyCode==13||keyCode==32||keyCode==46){ //»ñÈ¡µ±Ç°Îı¾¿òµÄÖµ var seachText=$("#seach").val(); if(seachText!=""){ //¹¹ÔìÏÔʾҳÃæ var tab="<table width='300' border='1' cellpadding='0' cellspacing='0'><tr align='center'><td>±àºÅ</td><td>Ãû³Æ</td><td>ÄêÁä</td></tr>"; //±éÀú½âÎöjson $.each(user,function(id, item){ //Èç¹û°üº¬ÔòΪtable¸³Öµ if(item.name.indexOf(seachText)!=-1){ tab+="<tr align='center'><td>"+item.id+"</td><td>"+item.name+"</td><td>"+item.age+"</td></tr>"; } }) tab+="</table>"; $("#div").html(tab); //ÖØи²¸Çµô£¬²»È»»á×·¼Ó tab="<table width='300' border='1' cellpadding='0' cellspacing='0'><tr align='center'><td>±àºÅ</td><td>Ãû³Æ</td><td>ÄêÁä</td></tr>"; }else{ $("#div").html(""); } // } }) }); </script> </head> <body> Ãû×Ö£º<input id="seach" /> <br/><br/> <div id="div"></div> </body> </html>
ÍƼöÐÅÏ¢
- jqueryʵÏÖÍøվͼƬÀÁ¼ÓÔØ´úÂë
- jQuery Tooltips²å¼þ
- jQueryµÄ.bind()¡¢.live()ºÍ.delegate(....
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- Ä㲻ϲ»¶»ðºü£¬µ«ÓÖϲ»¶firebug£¬ÄǾ͸úÎÒÒ»ÆðÀ´ÔÚIEÉÏ....
- ¸ù¾ÝÏÔʾÆ÷·Ö±æÂʵ÷ÕûÒ³ÃæÏÔʾµÄJavascript½Å±¾
- jQuery дµÄ·ÂÐÂÀË΢²© ÏòϹö¶¯Ð§¹û¡¾×ªÔØ¡¿
- ͨÓõÄJqueryÑ¡ÔñÆ÷
- jQuery ½áºÏ Json Ìá½»Êý¾Ýµ½Webservice£¬....
- ×ÔÖÆjQueryÖÇÄÜÌáʾ²å¼þһö
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- js»ñÈ¡srcÖд«µÝµÄ²ÎÊý
- jqueryʵÏÖÍøվͼƬÀÁ¼ÓÔØ´úÂë
- ÈÃä¯ÀÀÆ÷ÆÁ±ÎµôJavaScriptµÄ³ö´íÌáʾ
- github²»ÄܼÓÔØcss¡¢js½â¾ö°ì·¨
- ÎÒÖªµÀµÄJavaScript -- Éè¼Æģʽ(ÇŽÓ)Ó¦ÓÃÖ® ¨C ....
- 15¸öÖµµÃ¿ª·¢ÈËÔ±¹Ø×¢µÄjQuery¿ª·¢¼¼ÇɺÍÐĵÃ
- dz̸JavascriptÃæÏò¶ÔÏó±à³Ì
- JS¼òµ¥¶¯»·â×°
- JavaScript³õѧÕßӦעÒâµÄÆ߸öϸ½Ú
- jQuery Tooltips²å¼þ
ÆÀÂÛ