JavaScriptÕýÔò±í´ïʽ ½ø½×
ÕýÔò±í´ïʽÊÇÒ»¸öÃèÊö×Ö·ûģʽµÄ¶ÔÏó¡£
JavaScriptµÄRegExp¶ÔÏóºÍString¶ÔÏó¶¨ÒåÁËʹÓÃÕýÔò±í´ïʽÀ´Ö´ÐÐÇ¿´óµÄģʽƥÅäºÍÎı¾¼ìË÷ÓëÌæ»»º¯ÊýµÄ·½·¨.
'***********************
' \\JavaScript//
'
'***********************
ÔÚJavaScriptÖÐ,ÕýÔò±í´ïʽÊÇÓÉÒ»¸öRegExp¶ÔÏó±íʾµÄ.µ±È»,¿ÉÒÔʹÓÃÒ»¸öRegExp()¹¹Ô캯ÊýÀ´´´½¨RegExp¶ÔÏó,
Ò²¿ÉÒÔÓÃJavaScript 1.2ÖеÄÐÂÌí¼ÓµÄÒ»¸öÌØÊâÓï·¨À´´´½¨RegExp¶ÔÏó.¾ÍÏñ×Ö·û´®Ö±½ÓÁ¿±»¶¨ÒåΪ°üº¬ÔÚÒýºÅÄÚµÄ×Ö·ûÒ»Ñù,
ÕýÔò±í´ïʽֱ½ÓÁ¿Ò²±»¶¨ÒåΪ°üº¬ÔÚÒ»¶Ôб¸Ü(/)Ö®¼äµÄ×Ö·û.ËùÒÔ,JavaScript¿ÉÄÜ»á°üº¬ÈçϵĴúÂë:
var pattern = /s$/;
ÕâÐдúÂë´´½¨Ò»¸öеÄRegExp¶ÔÏó,²¢½«Ëü¸³¸ø±äÁ¿parttern.Õâ¸öÌØÊâµÄRegExp¶ÔÏóºÍËùÓÐÒÔ×Öĸ"s"½áβµÄ×Ö·û´®¶¼Æ¥Åä.ÓÃRegExp()Ò²¿ÉÒÔ¶¨Òå
Ò»¸öµÈ¼ÛµÄÕýÔò±í´ïʽ,´úÂëÈçÏÂ:
var pattern = new RegExp("s$");
ÎÞÂÛÊÇÓÃÕýÔò±í´ïʽֱ½ÓÁ¿»¹ÊÇÓù¹Ô캯ÊýRegExp(),´´½¨Ò»¸öRegExp¶ÔÏó¶¼ÊDZȽÏÈÝÒ×µÄ.½ÏΪÀ§ÄѵÄÈÎÎñÊÇÓÃÕýÔò±í´ïʽÓï·¨À´ÃèÊö×Ö·ûµÄģʽ.
JavaScript²ÉÓõÄÊÇPerlÓïÑÔÕýÔò±í´ïʽÓï·¨µÄÒ»¸öÏ൱ÍêÕûµÄ×Ó¼¯.
ÕýÔò±í´ïʽµÄģʽ¹æ·¶ÊÇÓÉһϵÁÐ×Ö·û¹¹³ÉµÄ.´ó¶àÊý×Ö·û(°üÀ¨ËùÓÐ×ÖĸÊý×Ö×Ö·û)ÃèÊöµÄ¶¼ÊÇ°´ÕÕ×ÖÃæÒâ˼½øÐÐÆ¥ÅäµÄ×Ö·û.ÕâÑù˵À´,ÕýÔò±í´ïʽ/java/¾ÍºÍ
ËùÓаüº¬×Ó´® "java" µÄ×Ö·û´®ÏàÆ¥Åä.ËäÈ»ÕýÔò±í´ïʽÖеÄÆäËü×Ö·û²»ÊÇ°´ÕÕ×ÖÃæÒâ˼½øÐÐÆ¥ÅäµÄ,µ«ËüÃǶ¼¾ßÓÐÌØÊâµÄÒâÒå.ÕýÔò±í´ïʽ /s$/ °üº¬Á½¸ö×Ö·û.
µÚÒ»¸öÌØÊâ×Ö·û "s" ÊÇ°´ÕÕ×ÖÃæÒâ˼Óë×ÔÉíÏàÆ¥Åä.µÚ¶þ¸ö×Ö·û "$" ÊÇÒ»¸öÌØÊâ×Ö·û,ËüËùÆ¥ÅäµÄÊÇ×Ö·û´®µÄ½áβ.ËùÒÔÕýÔò±í´ïʽ /s$/ Æ¥ÅäµÄ¾ÍÊÇÒÔ×Öĸ "s" ½áβ
µÄ×Ö·û´®.
1.Ö±½ÓÁ¿×Ö·û
ÎÒÃÇÒѾ·¢ÏÖÁË,ÔÚÕýÔò±í´ïʽÖÐËùÓеÄ×Öĸ×Ö·ûºÍÊý×Ö¶¼ÊÇ°´ÕÕ×ÖÃæÒâ˼Óë×ÔÉíÏàÆ¥ÅäµÄ.JavaScriptµÄÕýÔò±í´ïʽ»¹Í¨¹ýÒÔ·´Ð±¸Ü(\)¿ªÍ·µÄתÒåÐòÁÐÖ§³ÖijЩ·Ç
×Öĸ×Ö·û.ÀýÈç,ÐòÁÐ "\n" ÔÚ×Ö·û´®ÖÐÆ¥ÅäµÄÊÇÒ»¸öÖ±½ÓÁ¿»»Ðзû.ÔÚÕýÔò±í´ïʽÖÐ,Ðí¶à±êµã·ûºÅ¶¼ÓÐÌØÊâµÄº¬Òå.ÏÂÃæÊÇÕâЩ×Ö·ûºÍËüÃǵĺ¬Òå:
ÕýÔò±í´ïʽµÄÖ±½ÓÁ¿×Ö·û
×Ö·û Æ¥Åä
____________________________
Ïà¹ØÎĵµ£º
<script >
function showimage()
{
//IMG1ΪͼƬ¿Ø¼þ»òDiv,File1ΪÉÏ´«Îļþ¿Ø¼þ
document.getElementById("IMG1"). src = document.getElementById("File1").value;
}
</script >
¿Ø¼þÖÐÒýÓÃ:
<input id="File1" runat="server" type="file" onc ......
JavaScript API
One of the new features we added to the ASP.Net Report Viewer in Visual Studio 2010 is a JavaScript API to allow you to interact with the viewer on client. In reading many of the posts on the report controls forum, we found that many people struggle when implementing a custom ......
http://bei123wang.blog.163.com/blog/static/23175492009113022048840/
JavaScript ¶ÔÏó×ÖÃæÁ¿
javascript 2009-12-30 14:20:48 ÔĶÁ7 ÆÀÂÛ0 ×ֺţº´óÖÐС
JavaScript ¶ÔÏó×ÖÃæÁ¿
ÔÚ±à³ÌÓïÑÔÖУ¬×ÖÃæÁ¿ÊÇÒ»ÖÖ±íʾֵµÄ¼Ç·¨¡£ÀýÈ磬"Hello, World!" ÔÚÐí¶àÓïÑÔÖж¼±íʾһ¸ö×Ö·û´®×ÖÃæÁ¿£¨string literal £©£¬JavaScript ......
Ò»¡¢Ä¬ÈϺ¯Êý
JavaScriptÌṩÁËһЩĬÈϵĺ¯Êý
±àÂ뺯Êýescape()£º½«·Ç×Öĸ¡¢Êý×Ö×Ö·ûת»»³ÉASCIIÂë
ÒëÂ뺯Êýunescape()£º½«ASCIIÂëת»»³É×Öĸ¡¢Êý×Ö×Ö·û
ÇóÖµº¯Êýeval()
ÊýÖµÅжϺ¯ÊýisNaN()£ºÅжÏÒ»¸öÖµÊÇ·ñΪ·ÇÊýÖµÀàÐÍ
ÕûÊýת»»º¯ÊýparseInt()£º½«²»Í¬½øÖÆ£¨¶þ¡¢°Ë¡¢Ê®Áù½øÖÆ£©µÄÊýֵת»»³ÉÊ®½øÖ ......