Sign in or 

| <html><head></head><body><script type="text/vbscript">document.write("Hello from VBScript!")</script></body></html> |
| Hello from VBScript! |
| <script type="text/vbscript"> |
| document.write("Hello from VBScript!") |
| </script> |
| <script type="text/vbscript"><!-- some statements--></script> |
| <html><head><script type="text/vbscript"> some statements</script></head> |
| <html><head></head><body><script type="text/vbscript"> some statements</script></body> |
| <html><head><script type="text/vbscript"> some statements</script></head><body><script type="text/vbscript"> some statements</script></body> |
| dim namename=some value |
| name=some value |
| option explicitdim namename=some value |
| name="Hege"i=200 |
| dim names(2) |
| names(0)="Tove"names(1)="Jani"names(2)="Stale" |
| mother=names(0) |
| dim table(4, 6) |
| Sub mysub() some statementsEnd Sub or Sub mysub(argument1,argument2) some statementsEnd Sub |
| Function myfunction() some statementsmyfunction=some valueEnd Function orFunction myfunction(argument1,argument2) some statementsmyfunction=some valueEnd Function |
| name = findname() |
| msgbox "Your name is " & findname() |
| Call MyProc(argument) |
| MyProc argument |
| if i=10 Then msgbox "Hello" |
| if i=10 Then msgbox "Hello" i = i+1end If |
| if i=10 then msgbox "Hello"else msgbox "Goodbye"end If |
| if payment="Cash" then msgbox "You are going to pay cash!" elseif payment="Visa" then msgbox "You are going to pay with visa." elseif payment="AmEx" then msgbox "You are going to pay with American Express." else msgbox "Unknown method of payment."end If |
| select case payment case "Cash" msgbox "You are going to pay cash" case "Visa" msgbox "You are going to pay with visa" case "AmEx" msgbox "You are going to pay with American Express" case Else msgbox "Unknown method of payment"end select |
| For i=1 to 10 some codeNext |
| For i=2 To 10 Step 2 some codeNext |
| For i=10 To 2 Step -2 some codeNext |
| dim cars(2)cars(0)="Volvo"cars(1)="Saab"cars(2)="BMW" For Each x in cars document.write(x & "<br />")Next |
| Do While i>10 some codeLoop |
| Do some codeLoop While i>10 |
| Do Until i=10 some code Loop |
| Do some codeLoop Until i=10 |
| Do Until i=10 i=i-1 If i<10 Then Exit DoLoop |
| | | |
| Function | Description |
| CDate | Converts a valid date and time expression to the variant of subtype Date |
| Date | Returns the current system date |
| DateAdd | Returns a date to which a specified time interval has been added |
| DateDiff | Returns the number of intervals between two dates |
| DatePart | Returns the specified part of a given date |
| 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) |
| 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) |
| 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) |
| Month | Returns a number that represents the month of the year (between 1 and 12, inclusive) |
| 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) |
| Time | Returns the current system time |
| Timer | Returns the number of seconds since 12:00 AM |
| 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) |
| WeekdayName | Returns the weekday name of a specified day of the week |
| Year | Returns a number that represents the year |
Conversion Functions | Top |
| Function | Description |
| Asc | Converts the first letter in a string to ANSI code |
| CBool | Converts an expression to a variant of subtype Boolean |
| CByte | Converts an expression to a variant of subtype Byte |
| CCur | Converts an expression to a variant of subtype Currency |
| CDate | Converts a valid date and time expression to the variant of subtype Date |
| CDbl | Converts an expression to a variant of subtype Double |
| Chr | Converts the specified ANSI code to a character |
| CInt | Converts an expression to a variant of subtype Integer |
| CLng | Converts an expression to a variant of subtype Long |
| CSng | Converts an expression to a variant of subtype Single |
| CStr | Converts an expression to a variant of subtype String |
| Hex | Returns the hexadecimal value of a specified number |
| Oct | Returns the octal value of a specified number |
Format Functions | Top |
| Function | Description |
| 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 |
Math Functions | Top |
| Function | Description |
| 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 |
| 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 |
| 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) |
Array Functions | Top |
| Function | Description |
| Array | Returns a variant containing an array |
| 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 |
| 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 |
| UBound | Returns the largest subscript for the indicated dimension of an array |
String Functions | Top |
| Function | Description |
| 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 |
| RTrim | Removes spaces on the right side of a string |
| Trim | Removes spaces on both the left and the right side of a string |
| 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 |
| 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 |
Other Functions | Top |
| Function | Description |
| CreateObject | Creates an object of a specified type |
| Eval | Evaluates an expression and returns the result |
| GetLocale | Returns the current locale ID |
| GetObject | Returns a reference to an automation object from a file |
| 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 |
| IsNull | Returns a Boolean value that indicates whether a specified expression contains no valid data (Null) |
| IsNumeric | Returns a Boolean value that indicates whether a specified expression can be evaluated as a number |
| IsObject | Returns a Boolean value that indicates whether the specified expression is an automation object |
| 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 |
| 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 |
| VarType | Returns a value that indicates the subtype of a specified variable |
| Keyword | Description |
| empty | Used to indicate an uninitialized variable value. A variable value is uninitialized when it is first created and no value is assigned to it, or when a variable value is explicitly set to empty. Example: dim x 'the variable x is uninitialized! x="ff" 'the variable x is NOT uninitialized anymore x=empty 'the variable x is uninitialized! Note: This is not the same as Null!! |
| isEmpty | Used to test if a variable is uninitialized. Example: If (isEmpty(x)) 'is x uninitialized? |
| nothing | Used to indicate an uninitialized object value, or to disassociate an object variable from an object to release system resources. Example: set myObject=nothing |
| is nothing | Used to test if a value is an initialized object. Example: If (myObject Is Nothing) 'is it unset? Note: If you compare a value to Nothing, you will not get the right result! Example: If (myObject = Nothing) 'always false! |
| null | Used to indicate that a variable contains no valid data. One way to think of Null is that someone has explicitly set the value to "invalid", unlike Empty where the value is "not set". Note: This is not the same as Empty or Nothing!! Example: x=Null 'x contains no valid data |
| isNull | Used to test if a value contains invalid data. Example: if (isNull(x)) 'is x invalid? |
| true | Used to indicate a Boolean condition that is correct (true has a value of -1) |
| false | Used to indicate a Boolean condition that is not correct (false has a value of 0) |
arunraj |
Latest page update: made by arunraj
, Mar 16 2007, 4:51 AM EDT
(about this update
About This Update
Edited by arunraj
3960 words added view changes - complete history) |
|
Keyword tags:
None
More Info: links to this page
|