w3pop.com :: ÍøÂçѧԺ :: VBScript :: VBScript º¯Êý
This page contains all the built-in VBScript functions. The page is divided into following sections:
ÕâÒ³ÓÐVBScriptËùÄÚÖõÄËùÓк¯Êý¡£Ò³ÃæµÄÄÚÈÝ¿ÉÒÔ»®·ÖΪÒÔϼ¸¸ö²¿·Ö£º
| º¯ÊýÃû | ÃèÊö |
|---|---|
| CDate | Converts a valid date and time expression to the variant of subtype Date ·µ»Ø±í´ïʽ£¬´Ë±í´ïʽÒѱ»×ª»»Îª Date ×ÓÀàÐ굀 Variant |
| Date | ·µ»Øµ±Ç°ÏµÍ³ÈÕÆÚ¡£ |
| DateAdd | ·µ»ØÒÑÌí¼ÓÖ¸¶¨Ê±¼ä¼ä¸ôµÄÈÕÆÚ¡£ |
| DateDiff | ·µ»ØÁ½¸öÈÕÆÚÖ®¼äµÄʱ¼ä¼ä¸ô¡£ |
| DatePart | ·µ»Ø¸ø¶¨ÈÕÆÚµÄÖ¸¶¨²¿·Ö¡£ |
| DateSerial | Returns the date for a specified year, month, and day ·µ»ØÖ¸¶¨µÄÄ꣬Ô£¬ÈÕ |
| DateValue | Returns a date ·µ»ØÈÕÆÚ |
| Day | Returns a number that represents the day of the month (between 1 and 31, inclusive) ·µ»ØÈÕÆÚÖеÄÈÕ(ÔÚ1Óë31Ö®¼ä£¬°üº¬) |
| FormatDateTime | Returns an expression formatted as a date or time ·µ»Ø¸ñʽ»¯ºóµÄÈÕÆÚ»òÊÇʱ¼ä |
| Hour | Returns a number that represents the hour of the day (between 0 and 23, inclusive) ·µ»ØÊ±¼äÀïµÄСʱ£¨ÔÚ0ºÍ23Ö®¼ä£¬°üº¬£© |
| IsDate | Returns a Boolean value that indicates if the evaluated expression can be converted to a date ·µ»ØÒ»¸ö²¼¶úÖµ£¬Åжϵ±Ç°±í´ïʽÀïµÄÖµÊÇ·ñ¿ÉÒÔת»»³ÉÈÕÆÚ |
| Minute | Returns a number that represents the minute of the hour (between 0 and 59, inclusive) ·µ»ØÊ±¼äÀïµÄ·ÖÖÓ(ÔÚ0µ½59Ö®¼ä£¬°üº¬) |
| Month | Returns a number that represents the month of the year (between 1 and 12, inclusive) ·µ»ØÈÕÆÚÀïµÄÔ·Ý(ÔÚ1ºÍ12Ö®¼ä£¬°üº¬) |
| MonthName | Returns the name of a specified month ·µ»ØÖ¸¶¨Ô·ݵÄÃû³Æ |
| Now | Returns the current system date and time ·µ»Øµ±Ç°ÏµÍ³µÄÈÕÆÚÓëʱ¼ä |
| Second | Returns a number that represents the second of the minute (between 0 and 59, inclusive) ·µ»ØÊ±¼äÀïµÄÃë(ÔÚ0ºÍ59Ö®¼ä£¬°üº¬) |
| Time | Returns the current system time ·µ»Øµ±Ç°ÏµÍ³Ê±¼ä |
| Timer | Returns the number of seconds since 12:00 AM ·µ»Ø´ÓÎçÒ¹12µãµ½Ö¸¶¨Ê±¼äÖ®¼äµÄ×ÜÃëÊý |
| TimeSerial | Returns the time for a specific hour, minute, and second ·µ»ØÕë¶ÔСʱ£¬·ÖÖÓÒÔ¼°ÃëµÄʱ¼ä |
| TimeValue | Returns a time ·µ»ØÊ±¼ä |
| Weekday | Returns a number that represents the day of the week (between 1 and 7, inclusive) ·µ»ØÐÇÆÚ¼¸(´Ó1µ½7£¬°üº¬) |
| WeekdayName | Returns the weekday name of a specified day of the week ·µ»ØÖ¸¶¨ÈÕÆÚµÄÐÇÆÚÃû³Æ |
| Year | Returns a number that represents the year ·µ»ØÈÕÆÚÖеÄÄê·Ý |
ת»»º¯Êý |
Top |
| º¯ÊýÃû | ÃèÊö |
|---|---|
| Asc | ·µ»ØÓë×Ö·û´®µÄµÚÒ»¸ö×Öĸ¶ÔÓ¦µÄ ANSI ×Ö·û´úÂë |
| CBool | Converts an expression to a variant of subtype Boolean ·µ»Ø±í´ïʽ£¬´Ë±í´ïʽÒÑת»»Îª Boolean ×ÓÀàÐ굀 Variant¡£ |
| CByte | Converts an expression to a variant of subtype Byte ·µ»Ø±í´ïʽ£¬´Ë±í´ïʽÒѱ»×ª»»Îª Byte ×ÓÀàÐ굀 Variant |
| CCur | Converts an expression to a variant of subtype Currency ·µ»Ø±í´ïʽ£¬´Ë±í´ïʽÒѱ»×ª»»Îª Currency ×ÓÀàÐ굀 Variant |
| CDate | Converts a valid date and time expression to the variant of subtype Date ·µ»Ø±í´ïʽ£¬´Ë±í´ïʽÒѱ»×ª»»Îª Date ×ÓÀàÐ굀 Variant |
| CDbl | Converts an expression to a variant of subtype Double ·µ»Ø±í´ïʽ£¬´Ë±í´ïʽÒѱ»×ª»»Îª Double ×ÓÀàÐ굀 Variant |
| Chr | Converts the specified ANSI code to a character ·µ»ØÓëÖ¸¶¨µÄ ANSI ×Ö·û´úÂëÏà¶ÔÓ¦µÄ×Ö·û¡£ |
| CInt | Converts an expression to a variant of subtype Integer ·µ»Ø±í´ïʽ£¬´Ë±í´ïʽÒѱ»×ª»»Îª Integer ×ÓÀàÐ굀 Variant |
| CLng | Converts an expression to a variant of subtype Long ·µ»Ø±í´ïʽ£¬´Ë±í´ïʽÒѱ»×ª»»Îª Long ×ÓÀàÐ굀 Variant |
| CSng | Converts an expression to a variant of subtype Single ·µ»Ø±í´ïʽ£¬¸Ã±í´ïʽÒѱ»×ª»»Îª Single ×ÓÀàÐ굀 Variant |
| CStr | Converts an expression to a variant of subtype String ·µ»Ø±í´ïʽ£¬¸Ã±í´ïʽÒѱ»×ª»»Îª String ×ÓÀàÐ굀 Variant |
| Hex | Returns the hexadecimal value of a specified number ·µ»Ø±íʾʮÁù½øÖÆÊý×ÖÖµµÄ×Ö·û´®¡£ |
| Oct | Returns the octal value of a specified number ·µ»Ø±íʾÊý×ְ˽øÖÆÖµµÄ×Ö·û´® |
¸ñʽ»¯º¯Êý |
Top |
| º¯ÊýÃû | ÃèÊö |
|---|---|
| FormatCurrency | Returns an expression formatted as a currency value ·µ»Ø±í´ïʽ£¬´Ë±í´ïʽÒѱ»¸ñʽ»¯Îª»õ±ÒÖµ£¨Ê¹ÓÃϵͳ¿ØÖÆÃæ°åÖж¨ÒåµÄ»õ±Ò·ûºÅ£©¡£ |
| FormatDateTime | Returns an expression formatted as a date or time ·µ»Ø±í´ïʽ£¬´Ë±í´ïʽÒѱ»¸ñʽ»¯ÎªÈÕÆÚ»òʱ¼ä |
| FormatNumber | Returns an expression formatted as a number ·µ»Ø±í´ïʽ£¬´Ë±í´ïʽÒѱ»¸ñʽ»¯ÎªÊýÖµ¡£ |
| FormatPercent | Returns an expression formatted as a percentage ·µ»Ø±í´ïʽ£¬´Ë±í´ïʽÒѱ»¸ñʽ»¯ÎªÎ²ËæÓÐ % ·ûºÅµÄ°Ù·Ö±È£¨³ËÒÔ 100 £©¡£ |
¼ÆË㺯Êý |
Top |
| º¯ÊýÃû | ÃèÊö |
|---|---|
| Abs | Returns the absolute value of a specified number ·µ»ØÊý×ֵľø¶ÔÖµ¡£ |
| Atn | Returns the arctangent of a specified number ·µ»ØÊýÖµµÄ·´ÕýÇÐÖµ¡£ |
| Cos | Returns the cosine of a specified number (angle) ·µ»ØÄ³¸ö½ÇµÄÓàÏÒÖµ¡£ |
| Exp | Returns e raised to a power ·µ»Ø e£¨×ÔÈ»¶ÔÊýµÄµ×£©µÄÃݴη½¡£ |
| Hex | Returns the hexadecimal value of a specified number ·µ»Ø±íʾʮÁù½øÖÆÊý×ÖÖµµÄ×Ö·û´®¡£ |
| Int | Returns the integer part of a specified number ·µ»ØÊý×ÖµÄÕûÊý²¿·Ö |
| Fix | Returns the integer part of a specified number ·µ»ØÊý×ÖµÄÕûÊý²¿·Ö¡£ |
| Log | Returns the natural logarithm of a specified number ·µ»ØÊýÖµµÄ×ÔÈ»¶ÔÊý¡£ |
| Oct | Returns the octal value of a specified number ·µ»Ø±íʾÊý×ְ˽øÖÆÖµµÄ×Ö·û´®¡£ |
| Rnd | Returns a random number less than 1 but greater or equal to 0 ·µ»ØÒ»¸öСÓÚ1»ò´óÓÚµÈÓÚ0µÄËæ»úÊý¡£ |
| Sgn | Returns an integer that indicates the sign of a specified number ·µ»Ø±íʾÊý×Ö·ûºÅµÄÕûÊý¡£ |
| Sin | Returns the sine of a specified number (angle) ·µ»ØÄ³¸ö½ÇµÄÕýÏÒÖµ¡£ |
| Sqr | Returns the square root of a specified number ·µ»ØÊýÖµµÄƽ·½¸ù¡£ |
| Tan | Returns the tangent of a specified number (angle) ·µ»ØÄ³¸ö½ÇµÄÕýÇÐÖµ¡£ |
Êý×麯Êý |
Top |
| º¯ÊýÃû | ÃèÊö |
|---|---|
| Array | Returns a variant containing an array ·µ»Ø°üº¬Êý×éµÄ Variant¡£ |
| Filter | Returns a zero-based array that contains a subset of a string array based on a filter criteria ·µ»ØÏ±ê´ÓÁ㿪ʼµÄ Êý×飬ÆäÖаüº¬ÒÔÌØ¶¨¹ýÂËÌõ¼þΪ»ù´¡µÄ×Ö·û´®Êý×éµÄ×Ó¼¯¡£ |
| IsArray | Returns a Boolean value that indicates whether a specified variable is an array ·µ»Ø Boolean ÖµÖ¸Ã÷ij±äÁ¿ÊÇ·ñΪÊý×é¡£ |
| Join | Returns a string that consists of a number of substrings in an array ·µ»ØÒ»¸ö×Ö·û´®£¬´Ë×Ö·û´®Óɰüº¬ÔÚÊý×éÖеÄÐí¶à×Ó×Ö·û´®Áª½Ó´´½¨¡£ |
| LBound | Returns the smallest subscript for the indicated dimension of an array ·µ»ØÖ¸¶¨Êý×éάµÄ×îС¿ÉÓÃϱꡣ |
| Split | Returns a zero-based, one-dimensional array that contains a specified number of substrings ·µ»Ø»ùÓÚ 0 µÄһάÊý×飬ÆäÖаüº¬Ö¸¶¨ÊýÄ¿µÄ×Ó×Ö·û´®¡£ |
| UBound | Returns the largest subscript for the indicated dimension of an array ·µ»ØÖ¸¶¨Êý×éάÊýµÄ×î´ó¿ÉÓÃϱꡣ |
×Ö·û´®º¯Êý |
Top |
| º¯ÊýÃû | ÃèÊö |
|---|---|
| InStr | Returns the position of the first occurrence of one string within another. The search begins at the first character of the string ·µ»ØÄ³×Ö·û´®ÔÚÁíÒ»×Ö·û´®ÖеÚÒ»´Î³öÏÖµÄλÖᣠ|
| InStrRev | Returns the position of the first occurrence of one string within another. The search begins at the last character of the string ·µ»ØÄ³×Ö·û´®ÔÚÁíÒ»¸ö×Ö·û´®ÖгöÏֵĴӽáβ¼ÆÆðµÄλÖᣠ|
| LCase | Converts a specified string to lowercase ·µ»Ø×Ö·û´®µÄСдÐÎʽ¡£ |
| Left | Returns a specified number of characters from the left side of a string ·µ»ØÖ¸¶¨ÊýÄ¿µÄ´Ó×Ö·û´®µÄ×ó±ßËãÆðµÄ×Ö·û |
| Len | Returns the number of characters in a string ·µ»Ø×Ö·û´®ÄÚ×Ö·ûµÄÊýÄ¿£¬»òÊÇ´æ´¢Ò»±äÁ¿ËùÐèµÄ×Ö½ÚÊý¡£ |
| LTrim | Removes spaces on the left side of a string ·µ»Ø²»´øÇ°µ¼¿Õ¸ñ (LTrim) µÄ×Ö·û´®¸±±¾¡£ |
| RTrim | Removes spaces on the right side of a string ·µ»Ø²»´øºóÐø¿Õ¸ñ (RTrim) µÄ×Ö·û´®¸±±¾¡£ |
| Trim | Removes spaces on both the left and the right side of a string ·µ»Ø²»´øÇ°µ¼ÓëºóÐø¿Õ¸ñ (Trim) µÄ×Ö·û´®¸±±¾¡£ |
| Mid | Returns a specified number of characters from a string ´Ó×Ö·û´®Öзµ»ØÖ¸¶¨ÊýÄ¿µÄ×Ö·û¡£ |
| Replace | Replaces a specified part of a string with another string a specified number of times ·µ»Ø×Ö·û´®£¬ÆäÖÐÖ¸¶¨ÊýÄ¿µÄij×Ó×Ö·û´®±»Ì滻ΪÁíÒ»¸ö×Ó×Ö·û´® |
| Right | Returns a specified number of characters from the right side of a string ´Ó×Ö·û´®Óұ߷µ»ØÖ¸¶¨ÊýÄ¿µÄ×Ö·û |
| Space | Returns a string that consists of a specified number of spaces ·µ»ØÓÉÖ¸¶¨ÊýÄ¿µÄ¿Õ¸ñ×é³ÉµÄ×Ö·û´®¡£ |
| StrComp | Compares two strings and returns a value that represents the result of the comparison ·µ»ØÒ»¸ö±íÃ÷×Ö·û´®±È½Ï½á¹ûµÄÖµ¡£ |
| String | Returns a string that contains a repeating character of a specified length ·µ»Ø¾ßÓÐÖ¸¶¨³¤¶ÈµÄ¡¢Öظ´×Ö·û×é³ÉµÄ×Ö·û´® |
| StrReverse | Reverses a string ·µ»Ø×Ö·û´®£¬´Ë×Ö·û´®ÓëÖ¸¶¨×Ö·û´®Ë³ÐòÏà·´ |
| UCase | Converts a specified string to uppercase ·µ»Ø×Ö·û´®µÄ´óдÐÎʽ¡£ |
ÆäËüº¯Êý |
Top |
| º¯ÊýÃû | ÃèÊö |
|---|---|
| CreateObject | Creates an object of a specified type ´´½¨Ò»¸öÖ¸¶¨ÀàÐ͵ĶÔÏó |
| Eval | Evaluates an expression and returns the result ¼ÆËãÒ»¸ö±í´ïʽµÄÖµ²¢·µ»Ø½á¹û¡£ |
| GetLocale | Returns the current locale ID ·µ»Øµ±Ç°µÄÇøÓòÉèÖà ID Öµ¡£ |
| GetObject | Returns a reference to an automation object from a file ·µ»Ø¶ÔÎļþÖÐ Automation ¶ÔÏóµÄÒýÓà |
| GetRef | Allows you to connect a VBScript procedure to a DHTML event on your pages ·µ»ØÒ»¸öÖ¸ÏòÒ»¹ý³ÌµÄÒýÓ㬴˹ý³Ì¿É°ó¶¨Ä³Ê¼þ |
| InputBox | Displays a dialog box, where the user can write some input and/or click on a button, and returns the contents ÔÚ¶Ô»°¿òÖÐÏÔʾÌáʾ£¬µÈ´ýÓû§ÊäÈëÎı¾»òµ¥»÷°´Å¥£¬²¢·µ»ØÎı¾¿òÄÚÈÝ¡£ |
| IsEmpty | Returns a Boolean value that indicates whether a specified variable has been initialized or not ·µ»Ø Boolean ÖµÖ¸Ã÷±äÁ¿ÊÇ·ñÒѳõʼ»¯ |
| IsNull | Returns a Boolean value that indicates whether a specified expression contains no valid data (Null) ·µ»Ø Boolean Öµ£¬Ö¸Ã÷±í´ïʽÊÇ·ñ²»°üº¬ÈκÎÓÐЧÊý¾Ý (Null)¡£ |
| IsNumeric | Returns a Boolean value that indicates whether a specified expression can be evaluated as a number ·µ»Ø Boolean ÖµÖ¸Ã÷±í´ïʽµÄÖµÊÇ·ñΪÊý×Ö¡£ |
| IsObject | Returns a Boolean value that indicates whether the specified expression is an automation object ·µ»Ø Boolean ÖµÖ¸Ã÷±í´ïʽÊÇ·ñÒýÓÃÁËÓÐЧµÄ Automation ¶ÔÏó¡£ |
| LoadPicture | Returns a picture object. Available only on 32-bit platforms ·µ»ØÍ¼Æ¬¶ÔÏó¡£ |
| MsgBox | Displays a message box, waits for the user to click a button, and returns a value that indicates which button the user clicked ÔÚ¶Ô»°¿òÖÐÏÔʾÏûÏ¢£¬µÈ´ýÓû§µ¥»÷°´Å¥£¬²¢·µ»ØÒ»¸öֵָʾÓû§µ¥»÷µÄ°´Å¥¡£ |
| RGB | Returns a number that represents an RGB color value ·µ»Ø´ú±í RGB ÑÕɫֵµÄÕûÊý¡£ |
| Round | Rounds a number ·µ»Ø°´Ö¸¶¨Î»Êý½øÐÐËÄÉáÎåÈëµÄÊýÖµ¡£ |
| ScriptEngine | Returns the scripting language in use ·µ»ØÒ»¸ö´ú±íµ±Ç°Ê¹ÓõĽű¾³ÌÐòÓïÑÔµÄ×Ö·û´®¡£ |
| ScriptEngineBuildVersion | Returns the build version number of the scripting engine in use ·µ»ØÊ¹Óõıàд½Å±¾ÒýÇæµÄ±àÒë°æ±¾ºÅ¡£ |
| ScriptEngineMajorVersion | Returns the major version number of the scripting engine in use ·µ»ØÊ¹Óõıàд½Å±¾ÒýÇæµÄÖ÷°æ±¾ºÅ¡£ |
| ScriptEngineMinorVersion | Returns the minor version number of the scripting engine in use ·µ»ØÊ¹ÓõıàдÒýÇæÒýÇæµÄ´Î°æ±¾ºÅ¡£ |
| SetLocale | Sets the locale ID and returns the previous locale ID ÉèÖÃÈ«¾ÖÇøÓòÉèÖò¢·µ»ØÔÓеÄÇøÓòÉèÖᣠ|
| TypeName | Returns the subtype of a specified variable ·µ»ØÒ»¸ö×Ö·û´®£¬ÌṩÓйرäÁ¿µÄ Variant ×ÓÀàÐÍÐÅÏ¢¡£ |
| VarType | Returns a value that indicates the subtype of a specified variable ·µ»ØÖ¸Ê¾±äÁ¿×ÓÀàÐ͵ÄÖµ¡£ |