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

[ת]JavaScriptÖеÄtrimº¯Êý

/**
* È¥³ý¶àÓà¿Õ¸ñº¯Êý
* trim:È¥³ýÁ½±ß¿Õ¸ñ lTrim:È¥³ý×ó¿Õ¸ñ rTrim: È¥³ýÓÒ¿Õ¸ñ
* Ó÷¨£º
*     var str = "  hello ";
*     str = str.trim();
*/
String.prototype.trim = function()
{
    return this.replace(/(^[\\s]*)|([\\s]*$)/g, "");
}
String.prototype.lTrim = function()
{
    return this.replace(/(^[\\s]*)/g, "");
}
String.prototype.rTrim = function()
{
    return this.replace(/([\\s]*$)/g, "");
}


Ïà¹ØÎĵµ£º

javascript±äÁ¿×÷ÓÃÓò

±äÁ¿µÄ×÷ÓÃÓòÖ¸µÄÊDZäÁ¿µÄ¿É¼ûÐÔ£¬¶øÉúÃüÖÜÆÚÔò£¨´æ»îÆÚ£©ÔòÊÇ´ÓÁíÒ»¸ö½Ç¶È¿¼²ì±äÁ¿¡£ jsÖбäÁ¿µÄ×÷ÓÃÓò·ÖΪȫ¾Ö±äÁ¿ºÍ¾Ö²¿±äÁ¿£¬º¯ÊýÄÚ¶¨ÒåµÄ³ÆΪ¾Ö²¿±äÁ¿£¬º¯ÊýÍâµÄ³ÆΪȫ¾Ö±äÁ¿¡££¨¡°º¯ÊýÍâµÄ³ÆΪȫ¾Ö±äÁ¿¡±ÊÇÏà¶ÔµÄ£¬Áí´Ë´¦ÌÖÂÛµÄÇ°ÌáÊÇÓÃvarÏÔʽÉùÃ÷µÄ±äÁ¿£¬º¯ÊýÄÚ²»ÓÃvar¶¨ÒåµÄ±äÁ¿Ä¬ÈÏÊÇÈ«¾Ö±äÁ¿£¬µ±È»ºöÂÔvarÉùÃ÷± ......

[ת]javascriptÅжÏä¯ÀÀÆ÷ÀàÐÍÓë°æ±¾

ÒªÏëд³ö¿çä¯ÀÀÆ÷µÄjavascript£¬¾Í±ØÐ붮µÃÐá̽¼¼Êõ¡£ÕâÊÇä¯ÀÀÆ÷´óÕ½ÒÅÁôϵĴóµØÀ×£¬ÊÂÒÑÈç´Ë£¬Ö»ºÃÈÏÃü£¬¹Ô¹Ôд·ÖÖ§½á¹¹°É£¬º¯Êý¾ÍÊÇÕâÑù²»Öª²»¾õÖб䳤µÄ¡£
ÏÈ¿´µ¥Ò»ä¯ÀÀÆ÷µÄÅжϣ¬ÎÒÃÇûÓбØÐëÈ¥ÕÒnavigator.userAgentµÄÂé·³£¬ÎÒÔÚ¹úÍâµÄ²©¿ÍÍøÕ¾ÊÕ¼¯ÁËÈçÏÂhack£¬¶ÌС¾«º·£º
 
ie = !+"\v1" ;
ie ='\v'=='v' ; ......

Javascript¼òÒ×¼ÆʱÆ÷£¨ÓÃÀ´¼ÇËã´úÂëµÄÖ´ÐÐʱ¼ä£©

×Ô¼ºÐ´µÄÒ»¸ö¼òÒ×¼ÆʱÆ÷£¬ÄܼÇËã´úÂëµÄÖ´ÐÐʱ¼ä£¬»¹¿ÉÒÔÄÃÀ´²âÊÔ´úÂëµÄÖ´ÐÐЧÂÊ¡£
function Counter(){
this.start();
}
Counter.prototype.getTime = function(){
var time = new Date();
return time.getSeconds()*1000+time.getMilliseconds();
}
Counter.prototype.start = function(){
this. ......

Äã¶ÔjavascriptÊìϤÂð£¿Ò»µÀȤζÌâ¿´ÄãÊìϤ²»ÊìϤ

ÕâÊÇÒ»µÀº­¸ÇÁ˳õ¼¶¡¢¸ß¼¶javascript
µÄȤζ
ÌâÄ¿£¬Èç¹ûÄãÔÚ²»ÔËÐгÌÐò
µÄÌõ¼þÏÂÄÜÕýÈ·»Ø´ðÏÂÃæµÄº¯Êý
µ÷ÓõĽá¹û£¬ÄÇôÄã¶ÔjavascriptµÄÀí½âÓ¦¸Ã±È½Ïµ½Î»ÁË£¬ÖÁÉÙÎÒ£¨http://www.attjs.com
Õ¾³¤£©ÊÇÕâÑùÈÏΪµÄ¡£
Ö÷ÒªÉæ¼°javascriptÃæÏò¶ÔÏóÌØÐÔ¡¢ÖØÔØ¡¢¸²¸Ç¡¢×÷ÓÃÓò¡¢º¯ÊýÌØÐÔ¡¢»¹ÓÐÒ»¸öÏà¶ÔÓëC/C++
javaÌØÓеÄÒ» ......

½øÒ»²½Àí½âjavascript¶ÔÏó¡¢Êý×éºÍ¹þÏ£±í


½øÒ»²½Àí½âjavascript¶ÔÏó¡¢Êý×éºÍ¹þÏ£±í 



ÔÚjavascriptÖУ¬¶ÔÏóʵ¼ÊÉϾÍÊÇÒ»¸ö¹þÏ£±í£¬±ÈÈçÏÂÃæÕâ¸öuser¶ÔÏó£º
function user(n, a)
{
this.name = n;
this.age = a;
this.toString = function() {
return 'Name:' + ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ