




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































Example 2: Two or more declarations are separated by comma(,) Dim variable1,variable
DimintRadius intRadius= const pi=3. Area= piintRadiusintRadius MsgboxArea
VARIABLES:- VBScript variables are used to hold values or expressions. A variable can have a short name, like x, or a more descriptive name, like carname. Rules for VBScript variable names: Must begin with a letter Cannot contain a period (.) Cannot exceed 255 characters In VBScript, all variables are of type variant, that can store different types of data. Declaring (Creating) VBScript Variables:- Creating variables in VBScript is most often referred to as "declaring" variables. We can declare VBScript variables with the Dim, Public or the Private statement. Like this: Dim x Dim carname Now we have created two variables. The name of the variables are "x" and "carname". we can also declare variables by using its name in a script. Like this: carname="Volvo"
Int A Function, which returns the integer part of the given number Log A Function, which returns the natural logarithm of the given number. Negative numbers disallowed Oct A Function, which returns the Octal value of the given percentage Hex A Function, which returns the Hexadecimal value of the given number Rnd A Function, which returns a random number between 0 and 1 Sgn A Function, which returns a number corresponding to the sign of the specified number Sqr A Function, which returns the square root of the given number. Negative numbers disallowed Abs A Function, which returns the absolute value of the given number Exp A Function, which returns the value of e raised to the specified number Sin A Function, which returns sine value of the given number Cos A Function, which returns cosine value of the given number Tan A Function, which returns tan value of the given number B. DATE FUNCTIONS: (NOV.2012) Date functions helps the developers to convert date from one format to another or to express the date value in the format that suits a specific condition. Syntax:- variablename = Date_function_Name(Expression) Function Description Date A Function, which returns the current system date CDate A Function, which converts a given input to Date DateAdd A Function, which returns a date to which a specified time interval has been added DateDiff A Function, which returns the difference between two time period DatePart A Function, which returns a specified part of the given input date value DateSerial A Function, which returns a valid date for the given year,month and date FormatDateTime A Function, which formats the date based on the supplied parameters IsDate A Function, which returns a Boolean Value whether or not the supplied parameter is a date Day A Function, which returns an integer between 1 and 31 that represents the day of the specified Date
result is False) Or Performs a logical disjunction on two expressions (if either or both expressions evaluate to True, result is True). Not Performs logical negation on an expression. Xor Performs a logical exclusion on two expressions (if one, and only one, of the expressions evaluates to True, result is True. However, if either expression is Null, result is also Null).
We can also place
Example:-
OUTPUT:- Hello World!
Double Contains a float value, ranging between 1,79769313486232E308 and - 4,94065645841247E-324 for negative values and between 4,94065645841247E- 324 to 1,79769313486232E308 for positive values Date / Time contains a date between 1th January 100 and 31 December 9999. String Contains a string that can contain several billion characters Object Can contain any object Error Contains an error identifier
Example:- The following example causes a procedure called MyProc to execute 50 times. The For statement specifies the counter variable x and its start and end values. The Next statement increments the counter variable by 1. Sub DoMyProc50Times() Dim x For x = 1 To 50 MyProc Next End Sub
Date Function- It returns current system Date Dim myDate OUTPUT: 17-03- myDate=Date msgbox myDate IsDate- It checks weather the given value is Date type or not Examples:
Date2=#10-10-11# x=DateDiff("d", Date1, Date2) Msgbox x 'Differnce in days Likewise, Hours, Minutes and Seconds can be calculated.
RGB -The RGB function returns a number that represents an RGB color value. Syntax: RGB(red, green, blue) Parameter Description red Required. A number from 0 to 255, inclusive, representing the red component of the color green Required. A number from 0 to 255, inclusive, representing the green component of the color blue Required. A number from 0 to 255, inclusive, representing the blue component of the color Example: <%response.write(rgb(255,0,0))%> The output of the code above will be:255 ‘red Eval Function-Evaluates an expression and returns the result.
Example:-