Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascriptÕýÔò±í´ïʽµÄ»ù±¾ÖªÊ¶


1 javascript ÕýÔò
¶ÔÏó´´½¨ ºÍÓ÷¨
ÉùÃ÷javascript ÕýÔò
±í´ïʽ
¸´ÖÆ´úÂë
´úÂëÈçÏÂ:

var reCat = new RegExp("cat");
ÄãÒ²¿ÉÒÔ
var reCat = /cat/; //Perl ·ç¸ñ £¨ÍƼö£©

2 ѧϰ×î³£ÓÃµÄ test exec match search replace split 6¸ö·½·¨
1£© test ¼ì²éÖ¸¶¨µÄ×Ö·û´®ÊÇ·ñ´æÔÚ
¸´ÖÆ´úÂë
´úÂëÈçÏÂ:

var data = "123123";
var reCat = /123/gi;
alert(reCat.test(data)); //true
//¼ì²é×Ö·ûÊÇ·ñ´æÔÚ g ¼ÌÐøÍùÏÂ×ß i ²»Çø·Ö´óСд

2£© exec ·µ»Ø²éѯֵ
¸´ÖÆ´úÂë
´úÂëÈçÏÂ:

var data = "123123,213,12312,312,3,Cat,cat,dsfsdfs,";
var reCat = /cat/i;
alert(reCat.exec(data)); //Cat

3£©match µÃµ½²éѯÊý×é
¸´ÖÆ´úÂë
´úÂëÈçÏÂ:

var data = "123123,213,12312,312,3,Cat,cat,dsfsdfs,";
var reCat = /cat/gi;
var arrMactches = data.match(reCat)
for (var i=0;i < arrMactches.length ; i++)
{
alert(arrMactches[i]); //Cat cat
}

4£© search ·µ»ØËÑË÷λÖà ÀàËÆÓÚindexof
¸´ÖÆ´úÂë
´úÂëÈçÏÂ:

var data = "123123,213,12312,312,3,Cat,cat,dsfsdfs,";
var reCat = /cat/gi;
alert(data.search(reCat)); //23

5£© replace Ìæ»»×Ö·û ÀûÓÃÕýÔò
Ìæ»»
¸´ÖÆ´úÂë
´úÂëÈçÏÂ:

var data = "123123,213,12312,312,3,Cat,cat,dsfsdfs,";
var reCat = /cat/gi;
alert(data.replace(reCat,"libinqq"));

6£©split ÀûÓÃÕýÔò
·Ö¸îÊý×é
¸´ÖÆ´úÂë
´úÂëÈçÏÂ:

var data = "123123,213,12312,312,3,Cat,cat,dsfsdfs,";
var reCat = /\,/;
var arrdata = data.split(reCat);
for (var i = 0; i < arrdata.length; i++)
{
alert(arrdata[i]);
}

3 ѧϰÏ ¼òµ¥Àà ¸ºÏòÀà ·¶Î§Àà ×éºÏÀà
¸´ÖÆ´úÂë
´úÂëÈçÏÂ:

//¼òµ¥Àà
var data = "1libinqq,2libinqq,3libinqq,4libinqq";
var reCat = /[123]libinqq/gi;
var arrdata = data.match(reCat);
for (var i = 0; i < arrdata.length; i++)
{
alert(arrdata[i]); // 1libinqq 2libinqq 3libinqq
}
//¸ºÏòÀà
var data = "alibinqq,1libinqq,2libinqq,3libinqq,4libinqq"; //\u0062cf
var reCat = /[^a123]libinqq/gi;
var arrdata = data.matc


Ïà¹ØÎĵµ£º

JavaScript³õ²½½Ó´¥

ÔÚ×öÒ»¸öÏîÄ¿ÖУ¬½Ó´¥µ½ÁËJavaScript£¬Ö÷ÒªÊǵã»÷Ò»¸ö²éѯ°´Å¥È»ºóµ¯³öÒ»¸öÍøÒ³¶Ô»°¿ò£¬µ±ÔÚ¶Ô»°¿òÖÐÊäÈë²éѯÌõ¼þ£¬µã»÷È·¶¨ºóÓÖ·µ»Øµ½Ô­À´Ò³Ãæ,µÃ³ö²éѯ½á¹û¡£
Ò³ÃæÈçͼ£º
ÔÚǰ̨¼ÓÁËÒ»¸öÒþ²ØµÄDIV£¬ÀïÃæ·ÅÈëÁ½¸ö¿Ø¼þ¡£ÈçÏ£º
 <div style="display:none">
        < ......

ÓÃjavascript»º´æajaxÊý¾Ý

ÎÒÃǶ¼ÖªµÀ£¬ajaxÄÜÌá¸ßÒ³ÃæÔØÈëµÄËٶȵÄÖ÷ÒªÔ­ÒòÊÇͨ¹ýajax¼õÉÙÁËÖظ´Êý¾ÝµÄÔØÈ룬ÕæÕý×öµ½°´Ðè»ñÈ¡£¬¼ÈÈ»Èç´Ë£¬ÎÒÃÇÔÚдajax³ÌÐòµÄʱºò²»·ÁËÍ·ðË͵½Î÷£¬ÔÚ¿Í»§¶ËÔÙ×öÒ»´Î»º´æ,½øÒ»²½Ìá¸ßÊý¾ÝÔØÈëËٶȡ£ÄǾÍÊÇÔÚÔØÈëÊý¾ÝµÄͬʱ½«Êý¾Ý»º´æÔÚä¯ÀÀÆ÷ÄÚ´æÖУ¬Ò»µ©Êý¾Ý±»ÔØÈ룬ֻҪҳÃæδˢУ¬¸ÃÊý¾Ý¾ÍÓÀÔ¶µÄ»º´æÔÚÄÚ´æÖУ¬µ±Ó ......

javascript ʵÏÖÊý¾Ý±í¸ñÏÔʾµÄÕ¹¿ªÓëÕÛµþ

<script   language="javascript">  
  function   ShowTableRow(id)
 
  { 
  var _Row = document.getElementById(id)   <!-- »ñÈ¡IDΪTableRowID µÄ¶ÔÏó -->
  var _Img = document.getElementById("Img"+id)
 
&nb ......

9 ¸ö»ùÓÚJavaScript ºÍ CSS µÄ Web ͼ±í¿ò¼Ü


      jQuery, MooTools, Prototype µÈÓÅÐãµÄ
JavaScript ¿ò¼ÜÓµÓи÷ÖÖÇ¿´óµÄ¹¦ÄÜ£¬°üÀ¨»æÖÆ Web ͼ±í£¬Ê¹ÓÃÕâЩ¿ò¼ÜÒÔ¼°ÏàÓ¦²å¼þ£¬ÎÒÃÇ¿ÉÒԷdz£ÇáËɵØʵÏÖÇúÏßͼ£¬Ô²±ýͼ£¬Öù״ͼµÈ
Web ͼ±íµÄ»æÖÆ£¬¶ø²»±ØÏóÒÔÍùÄÇÑùͨ¹ý¸´Ô Flash ¼¼ÊõʵÏÖ¡£±¾ÎĽéÉÜÁË9¸öÓÅÐãµÄ»ùÓÚ JavaScript Óë CSS& ......

JavaScript ½âÎö JSON Êý¾Ý

JSON £¨JavaScript Object Notation£©Ò»ÖÖ¼òµ¥µÄÊý¾Ý¸ñʽ£¬±Èxml¸üÇáÇÉ¡£ JSON ÊÇ JavaScript Ô­Éú¸ñʽ£¬ÕâÒâζ×ÅÔÚ JavaScript Öд¦Àí JSON Êý¾Ý²»ÐèÒªÈκÎÌØÊâµÄ API »ò¹¤¾ß°ü¡£
JSONµÄ¹æÔòºÜ¼òµ¥£º ¶ÔÏóÊÇÒ»¸öÎÞÐòµÄ“‘Ãû³Æ/Öµ’¶Ô”¼¯ºÏ¡£Ò»¸ö¶ÔÏóÒÔ“{”£¨×óÀ¨ºÅ£©¿ªÊ¼£¬“}&rdq ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ