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 ¸ö×Ó±í´ïʽ , Ò²¾ÍÊÇ .*?
ÔÀ´·Ö×é¾ÍÊÇÕýÔò±í´ïʽµÄ×Ó±í´ïʽ
Ïà¹ØÎĵµ£º
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';"
)& ......
ASP.NETÖÐǰ̨javascriptÓëºǫ́´úÂëµ÷ÓÃ
2010-03-31 10:01
.netÖÐC#´úÂëÓëjavaScriptº¯ÊýµÄÏ໥µ÷ÓÃÎÊÌâ¡£
¡¡¡¡ÎÊ£º
¡¡¡¡1.ÈçºÎÔÚJavaScript·ÃÎÊC#º¯Êý?
¡¡¡¡2.ÈçºÎÔÚJavaScript·ÃÎÊC#±äÁ¿?
¡¡¡¡3.ÈçºÎÔÚC#ÖзÃÎÊJavaScriptµÄÒÑÓбäÁ¿?
¡¡¡¡4.ÈçºÎÔÚC#ÖзÃÎÊJavaScriptº¯Êý?
¡¡¡¡ÎÊÌâ1´ð°¸ÈçÏ£º
¡¡¡¡javaScriptº¯ ......
javascript³õѧÕß
——È«Ãæѧϰ¶ÔÏó¸ÅÄî
±¾ÎĽéÉÜÁ˼¸ºõËùÓйØÓÚ¶ÔÏóµÄ»ù±¾¸ÅÄʲôÊǶÔÏó£¬ÈçºÎ´´½¨¶ÔÏ󣬶ÔÏóµÄÊôÐÔµÄÉèÖúͶÁÈ¡£¬É¾³ýÊôÐԵķ½·¨£¬¹¹Ô캯Êý£¬¶ÔÏóÔÐÍ£¬¸¸À࣬×ÓÀ࣬¼Ì³ÐµÈµÈ¡£
1.¶ÔÏó
* ¶ÔÏóÊÇÒ»ÖÖ¸´ºÏÊý¾ÝÀàÐÍ£¬ËüÃǽ«¶à¸öÊý¾ÝÖµ¼¯ÖÐÔÚÒ»¸öµ¥ÔªÖУ¬¶øÇÒÔËÐÐʹÓÃÃû×ÖÀ´´æÈ¡ÕâЩֵ¡£½âÊ ......
º¯Êý
¼´Ê¹º¯ÊýȷʵÓзµ»ØÖµ£¬Ò²²»±ØÃ÷È·µØÉùÃ÷Ëü¡£¸Ãº¯ÊýÖ»ÐèҪʹÓÃreturnÔËËã·ûºó¸úÒª·µ»ØµÄÖµ¼´¿É¡£
Àý£º
function sum(iNum1, iNum2)
{
  ......
±Õ°ü£º
ECMAScriptÖ§³Ö±Õ°ü¡£Ëùν±Õ°ü£¬¾ÍÊǺ¯ÊýÄÜʹÓú¯ÊýÍⶨÒåµÄ±äÁ¿¡£
var iBaseNum = 10;
function addNumbers(iNum1, iNum2)
{
function doAddition()
......