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

JavaScript ÕýÔò±í´ïʽ Ñ¡Ôñ¡¢·Ö×éºÍÒýÓÃ

JavaScriptµÄÕýÔò±í´ïʽ֧³Ö²¼¶û²Ù×÷£¬³ýÁË×÷Ϊ Ñ¡ÔñµÄ“²¼¶û»ò”²Ù×÷Ö®Í⣬ÕýÔò±í´ïʽ»¹Ö§³Ö·Ö×éºÍÒýÓÃ
¡£ÆäʵѡÔñ¡¢·Ö×éºÍÒýÓõÄ×÷Ó÷ֱðΪ£ºÖ¸¶¨Ñ¡ÔñÏî¡¢¶Ô×Ó±í´ïʽ·Ö×éºÍÒýÓà ǰһ×Ó±í´ïʽµÄÌØÊâ×Ö·û¡£
ÕýÔò±í´ïʽµÄÑ¡Ôñ£º
ËùνѡÔñ¼´ÔÚ¶à¸öÌõ¼þÀïÃæÑ¡ÔñÒ»¸ö£¬±ÈÈç˵ÂôË®¹ûµÄ´óү˵ËÍÄã¸öË®¹û£¬Äã¿ÉÒÔÑ¡Ôñ“À攣¬“Æ»¹û”£¬“Î÷¹Ï”ÖеÄÈκÎÒ»¸ö¡£µ±È»Äã»áÑ¡ÔñÎ÷¹Ï£¬ºÇºÇ¡£
×Ö·û”|”ÓÃÓÚ·Ö¸ô¹©Ñ¡ÔñµÄ×Ö·û
£¬ÀýÈç/Î÷¹Ï|Àæ|Æ»¹û/Æ¥ÅäµÄÊÇ“Î÷¹Ï”£¬“À攣¬»òÕßÊÇ“Æ»¹û”¡£Í¬ÑùÎÒÒª
ÊÇÏë¸ù¾Ý×òÌì½²¹ýµÄ×Ö·ûÀàȥƥÅäһЩ¹æÔò£¬±ÈÈçÎÒÏëÆ¥Åä3¸öÊý×Ö£¬»òÕßÊÇ4¸öСд×Öĸ¾Í¿ÉÒÔÓÃģʽ/\d{3}|[a-z]{4}/£¬ºÇºÇ£¬Õ¦Ñù£¿¼´Á˽â
ÁËÑ¡Ôñ£¬ÓÖÓÃÉÏÁË×Ö·ûÀ࣬ͬʱÄØÎÒÃÇ»¹Óõ½ÁËÖظ´£¬Õ⼸Ìì½²µÄ¶«Î÷¶¼¸´Ï°ÁËÒ»±é£¬¹þ¹þ¡£
Ñ¡ÔñÏîÊÇ´Ó×óµ½ÓÒ¿¼ÂÇ£¬Ö±µ½·¢ÏÖÁËÆ¥ÅäÏî¡£Èç¹û×ó±ßµÄÑ¡ÔñÏîÆ¥Å䣬ÔòºöÂÔÓұߵÄÆ¥ÅäÏ¼´Ê¹Ëü²úÉú¸üºÃµÄÆ¥Åä¡£
ÆäʵÉÏÃæµÄ»°ÊǺܺÃÀí½âµÄ£¬»¹ÊÇÄôóÒ¯ËÍÄãË®¹ûµÄÀý×Ó£¬´óÒ¯µÚÒ»´ÎÄóöÎ÷¹Ï£¬ÎÊÄãÒª²»Òª£¿Èç¹ûÄãÑ¡ÔñÁËÎ÷¹Ï£¬´óÒ¯×ÔÈ»²»»áÔÙÎÊÄãÒª²»ÒªÆ»¹û»òÕßÀæÁË¡£¶øÈç¹ûÄã²»ÒªÎ÷¹Ï£¬ÄÇô´óÒ¯»áÔÙÄóö¸öÀ棬ÎÊÄãÒª²»Òª£¿¾ÍÊÇÕâ¸öµÀÀí¡£
ÕýÔò±í´ïʽµÄ·Ö×飺
ÎÒÃÇ¿ÉÒÔͨ¹ýʹÓÃСÀ¨ºÅÀ´¶ÔÕýÔò±í´ïʽ½øÐзÖ×é
¡£Ëùν·Ö×飬Æäʵ¿ÉÒÔÀí½âΪºÏ×÷»ï°é£¬ÇÒÊÇÎÞÉÌÒµÀûÒæµÄ£¬ºÏ×÷»ï°éÖ®¼äµÄ¹ØϵÊÇÒ»ÈÙ¾ãÈÙ£¬Ò»Ëð¾ãËð¡£Ò²¾ÍÊÇ˵°ÑÀ¨ºÅÄڵĶ«Î÷µ±³ÉÒ»¸öС×飬һ¸öµ¥Ôª¡£·Ö×é¾Í¾ÍÊÇÕýÔò±í´ïʽÖеÄ×Ó±í´ïʽ£¬Õâ¸öÎÒÃÇÏÂÃæµÄÒýÓûὲµ½¡£
Ò»¸öµ¥Ôª¾Í˵Ã÷ºóÃæµÄÖظ´¹æÔò£¬ÓëÇ°ºóС×é¼äµÄ“»ò”¹Øϵ£¬¶¼ÊÇÒÔС×éΪµ¥Î»µÄ¡£Ð¡×éÀïµÄ¶«Î÷ÊÇͳһ´¦ÀíµÄ¡£
//ÈçÏÂģʽ¼´¿ÉÒÔÆ¥Åäjava£¬Ò²¿ÉÒÔÆ¥Åäjavascript
//ÒòΪ?±íʾµÄÊdzöÏÖ0´Î»ò1´Î£¬Èç¹ûÒ»´Î²»³öÏÖÄÇô¾ÍÆ¥ÅäµÄÊÇjava
//·ñÔòÆ¥ÅäµÄ¾ÍÊÇjavascript
var
pattern =
/java(script)?/
;
//ÏÂÃæ´úÂë·µ»ØµÄÊÇabcdcd,cd,ef,,efnull
var
patt1=
new
RegExp(
"(ab|cd)+|(ef)"
,
"g"
)
;
do
{
result=
patt1.exec
(
"abcdcdef"
)
;
document.write
(
result)
;
}
while
(
result!=
null
)
ÔÚJavaScript1.5ÖУ¬ÎÞÐë´´½¨´ø±àÂëµÄÒýÓþͿÉÒÔ½«ÕýÔò±í´ïʽÖеÄÏîÄ¿½øÐÐ×éºÏ¡£Ëü²»ÊÇÒÔÀ¨ºÅ¶ÔÏîÄ¿½øÐзÖ×飬¶øÊÇÒÔ”(?:”ºÍ&r


Ïà¹ØÎĵµ£º

ÀûÓÃjavascriptÑéÖ¤ÓÊÏäµØÖ·ÊÇ·ñºÏ·¨

Ô´´úÂëÈçÏ£º
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>ÑéÖ¤ÓÊÏäµØÖ·ºÏ·¨ÐÔ</title>
    <sc ......

JavascriptÔÚÒ³Ãæ¼ÓÔØʱµÄÖ´ÐÐ˳Ðò

Ò»¡¢ÔÚHTMLÖÐǶÈëJavasriptµÄ·½·¨
Ö±½ÓÔÚJavascript´úÂë·ÅÔÚ±ê¼Ç¶Ô<script>ºÍ</script>Ö®¼ä
ÓÉ<script />±ê¼ÇµÄsrcÊôÐÔÖƶ¨ÍⲿµÄjsÎļþ
·ÅÔÚʼþ´¦Àí³ÌÐòÖУ¬±ÈÈ磺<p onclick="alert('ÎÒÊÇÓÉonclickʼþÖ´ÐеÄJavascript')">µã»÷ÎÒ</p>
×÷ΪURLµÄÖ÷Ì壬Õâ¸öURLʹÓÃÌØÊâµÄJavascript ......

10¸ö·Ç³£°ôµÄAjax¼°JavascriptʵÀý×ÊÔ´ÍøÕ¾

1.Ajax Rain
¡¡¡¡AjaxRainÓкܶàÍêÃÀÕûºÏAJAX, CSS, DHTML »ò JavascriptµÄʵÀý£¬ÓÐһЩDemoµÄÈ·ÖµµÃÄãÈ¥¿´Ò»¿´£¬¼´Ê¹Äã²»ÊÇÍøÒ³Éè¼Æ(¿ª·¢)ʦ¡£
Ajax/JavascriptʵÀý:
 EXT JS Date Picker
 jQuery Feed Menu
 jGrowl
 FastFind Menu – Jquery
 Spiffy Accordion
2.Ajax Daddy ......

JavaScript ÓÃÓÚģʽƥÅäµÄ RegExp ·½·¨

±¾ÆªÈÕÖ¾ÏÈÖ÷ÒªÌÖÂÛ RegExp ¶ÔÏóµÄ²¿·Ö·½·¨£¬RegExp ¶ÔÏó¶¨ÒåÁËÁ½¸öÓÃÓÚģʽƥÅäµÄ·½·¨£¬ËüÃÇÊÇexec()
ºÍtest()
ÏÂÃæÎÒÃÇÖðÒ»½øÐн²½â
¡£ºÇ£¬ºÍÉÏƪÈÕÖ¾Ò»ÑùµÄ½éÉÜ£¬¿´À´Ì×»°£¬¹ûÈ»ÊÊÓÃÓÚ¶à¸ö³¡ºÏ¡£àÅ¡£
exec() ¼ìË÷×Ö·û´®ÖеÄÖ¸¶¨Öµ£¬·µ»ØÖµÊDZ»ÕÒµ½µÄÖµ£¬Èç¹ûûÓз¢ÏÖÆ¥Å䣬Ôò·µ»Ø null£º
Ö÷ÒªµÄRegExpģʽƥÅä·½·¨Ê ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ