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

javascriptÕýÔò±í´ïʽʵÏÖtrim()ÒÉ»ó

ÕýÔÚ¿´¡¡javascript¸ß¼¶³ÌÐòÉè¼Æ¡¡,ÆäÖйØÓÚ·Ö×éÀïÃæµÄÒ»¾ä´úÂë²»ÊÇÌ«Àí½â:
ͨ¹ýÅäºÏʹÓÃString¶ÔÏóµÄreplace()·½·¨¼°·´ÏòÒýÓ㬾ͿÉÒÔ¶¨Òå×Ô¼ºµÄtrim()·½·¨:
String.prototype.trim = function() {
var reExtraSpace = /^\s+(.*?)\s+$/;
return this.replace(reExtraSpace,"$1");
}
 
Ò»¿ªÊ¼ÔõôҲ²»Àí½â trim() ·½·¨ÊÇÔõôÆð×÷ÓõÄ
var sTest = " this is a test ";
alert("[" + sTest + "]"); //outputs " [ this is a test ] "
alert("[" + sTest.trim() + "]"); outputs " [this is a test] " 
ºóÀ´²éÁËһϡ¡javascript ÀïÃæ StringObject µÄ replace(regexp,replacement)
·½·¨µÄµÚ¶þ¸ö²ÎÊýreplacementÀïÃæµÄ"$"ÌØÊ⺬Ò壺
$n±íʾµÚ n ¸ö×Ó±í´ïʽ , Ò²¾ÍÊÇ .*?
Ô­À´·Ö×é¾ÍÊÇÕýÔò±í´ïʽµÄ×Ó±í´ïʽ


Ïà¹ØÎĵµ£º

ASP.NETÓëJavaScript½»»¥

1.asp.netºô½Ðjs
view
plain
copy
to clipboard
print
?
Response.Write("<mce:script language=javascript><!--  
");  
Response.Write("alert('»¶Ó­Äú ');"
 );  
Response.Write("location.href='login.aspx';"
)& ......

JavaScript¶ÔÏóµÄ·Ï³ý


ECMAScriptÓÐÎÞÓô洢µ¥ÔªÊÕ¼¯³ÌÐò£¬µ±ÔÚÔÙûÓжԶÔÏóµÄÒýÓÃʱ£¬³Æ¸Ã¶ÔÏ󱻷ϳý£¨dereference£©ÁË¡£
ÔËÐÐÎÞÓô洢µ¥ÔªÊÕ¼¯³ÌÐòʱ£¬ËùÓзϳýµÄ¶ÔÏ󶼱»Ïú»Ù¡£
°Ñ¶ÔÏóµÄËùÓÐÒýÓö¼ÉèÖÃΪnull£¬¿ÉÒÔÇ¿ÖÆÐԵķϳý¶ÔÏó£¬ÀýÈ磺
    var oObject = new Object;
    .......
   &n ......

javaScript(&jQuery)¹¤¾ß¼°ÏàÓ¦ÍøÕ¾×ÊÁÏ

1.Dean Edwards±àдµÄPacker£¨http://dean.edwards.name/packer/£©£¬ÓÃÓÚѹËõJavaScript
2.»ñÈ¡JQuery£ºhttp:/jquery.com 
                     http://docs.jquery.com/Downloading_jQuery   ÏÂÔظ÷¸ö°æ±¾¼°ÏàÓ¦°ïÖúÎ ......

JavaScriptµÄswitchÓï¾ä


ECMAScriptÖУ¬switchÓï¾ä¿ÉÒÔÓÃÓÚ×Ö·û´®£¬¶øÇÒÄÜÓò»Êdz£Á¿µÄֵ˵Ã÷Çé¿ö:
    var BLUE="blue" , RED = "red" , GREEN = "green";
    switch(sColor)
    {
        case BLUE:   alert("Blue"); break;
    &nb ......

JavaScriptµÄÒýÓÃÀàÐÍ


ÒýÓÃÀàÐÍͨ³£½Ð×öÀࣨclass£©£¬Óöµ½ÒýÓÃֵʱ£¬Ëù´¦ÀíµÄ¾ÍÊǶÔÏó¡£
    ¶ÔÏóµÄ´´½¨£º    
        var o = new Object();
        Èç¹ûûÓвÎÊý¿ÉÒÔÊ¡ÂÔÀ¨ºÅ£¬È磺var o = new Object;
   ObjectÀࣺ
&nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ