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

Ôö¼Ó javascript µÄ trim º¯Êý


È¥³ý×Ö·û´®×óÓÒÁ½¶ËµÄ¿Õ¸ñ£¬ÔÚvbscriptÀïÃæ¿ÉÒÔÇáËɵØÊ¹Óàtrim¡¢ltrim »ò rtrim£¬µ«ÔÚjsÖÐȴûÓÐÕâ3¸öÄÚÖ÷½·¨£¬ÐèÒªÊÖ¹¤±àд¡£ÏÂÃæµÄʵÏÖ·½·¨ÊÇÓõ½ÁËÕýÔò±í´ïʽ£¬Ð§Âʲ»´í£¬²¢°ÑÕâÈý¸ö·½·¨¼ÓÈëString¶ÔÏóµÄÄÚÖ÷½·¨ÖÐÈ¥¡£
<input type="text" name="mytxt" value="   12345678    " /><br>
<input type="button" name="cmd1" onclick="mytxt2.value=mytxt.value.trim()" value="È¥Á½±ßµÄ¿Õ¸ñ"/>
<input type="text" name="mytxt2"/><br>
<input type="button" name="cmd1" onclick="mytxt3.value=mytxt.value.ltrim()" value="È¥×ó±ßµÄ¿Õ¸ñ"/>
<input type="text" name="mytxt3"/><br>
<input type="button" name="cmd1" onclick="mytxt4.value=mytxt.value.rtrim()" value="È¥ÓұߵĿոñ"/>
<input type="text" name="mytxt4"/><br>
<script language="javascript">
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,"");
}
</script>
д³Éº¯Êý¿ÉÒÔÕâÑù£º
<script type="text/javascript">
function trim(str){  //ɾ³ý×óÓÒÁ½¶ËµÄ¿Õ¸ñ
 return str.replace(/(^s*)|(s*$)/g, "");
}
function ltrim(str){  //ɾ³ý×ó±ßµÄ¿Õ¸ñ
 return str.replace(/(^s*)/g,"");
}
function rtrim(str){  //ɾ³ýÓұߵĿոñ
 return str.replace(/(s*$)/g,"");
}
</script>


Ïà¹ØÎĵµ£º

[·­Òë]High Performance JavaScript(005)

µÚ¶þÕ  Data Access  Êý¾Ý·ÃÎÊ
    One of the classic computer science problems is determining where data should be stored for optimal reading and writing. Where data is stored is related to how quickly it can be retrieved during code execution. This problem in JavaScri ......

һЩjavascriptÌâÄ¿

ȺÀïÌÖÂÛ¹ýµÄÌâÄ¿£¬·ÖÏíһϡ£
function test(){
var m=n=1;
alert(m);
}
alert(n);
//ÒòΪtestº¯ÊýûÓÐÖ´ÐУ¬³Ì¶È¿ØÖÆÁ÷²»ÄܽøÈë½øÐнâÎö£¬ÀïÃæµÄ¶«Î÷¶ÔÍâÃæ²»¿É¼û£¬Òò´Ë±¨´í
function test(){
var m=n=1;
alert(m);
}
test();
alert(n);
//µ±testÖ´Ðкó£¬Í ......

Javascript±äÁ¿×÷ÓÃÓò

ÇëÏÈ¿´ÏÂÌ⣺
if(true)
{
     a = 1;
}
alert(a);  //Êä³öɶ£¿
if(true)
{
    var a = 1; 
}
alert(a);  //ÕâÓÖÊä³öʲô£¿
ÔÚfirefox3.5Ï£¬µÚÒ»¸öÊä³ö1;µÚ¶þ¸öÊä³öundefined£¡£¡£¡
ÎªÉ¶ÄØ£¿ºÇºÇ£¬±¾ÈËÔڴ˰àÃÅŪ¸«Ò»Ï£º
Ò»°ãÇé¿öÏÂȱʡvarÉùÃ÷ʱ£¬Ä¬È ......

javascriptдÀ෽ʽ֮Èý

È¡Ç°ÃæÁ½ÖÖµÄÓŵ㣺
a¡¢Óù¹Ô캯ÊýÀ´¶¨ÒåÀàÊôÐÔ£¨×ֶΣ©
b¡¢ÓÃÔ­ÐÍ·½Ê½À´¶¨ÒåÀàµÄ·½·¨¡£
¾ÍÓÐÁ˵ÚÈýÖÖ·½Ê½¡£ÕâÖÖ·½Ê½Ã²ËƲÉÓõÄÈ˽϶ࡣ
3¡¢×ۺϹ¹Ô캯Êý/Ô­ÐÍ
/**
* PersonÀࣺ¶¨ÒåÒ»¸öÈË£¬ÓиöÊôÐÔname£¬ºÍÒ»¸ögetName·½·¨
* @param {String} name
*/
function Person(name) {
this.name = name;
}
Pers ......

VB.NET/C# and JavaScript communication

Introduction
This article is about passing data between VB.NET/C# WinForms and JavaScript.
Before reading further, let me warn you that this article is not about ASP.NET. Concepts covered in the article are applied to Desktop applications.
Background
I was working on a project which required dat ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ