You cannot call the Microsoft Visual Basic® Script Edition (VBScript) function directly in the Microsoft JScript® code. This is because the data types used in each language are different:
• VBScript has only one data type, namely Variant, which can contain many different types of data. • JScript has a primitive data type for strings, numbers, and boolean values, and reference data types for objects and arrays.
VBScript can explain the JScript primitive data type, so you can pack the desired function in a custom VBScript function. For this, please see the following code example.
VAR Xmas = "december 25, 2001";
Function showtoday ()
{
Alert ("Today IS" Today ());
}
Function showTomorrow ()
{
Alert ("Tomorrow Is" Tomorrow ());
}
Function ShowTime (Date)
{
Alert ("The Date IS" Anytime (Date);
}
Function showdaysuntilxmas ()
{
Alert ("" DaySuntilxmas () "days untric xmas");
}
Script>
Function Today ()
Today = formatdatetime (date)
END FUNCTION
Function Tomorrow ()
Tomorrow = formatdatetime (DateAdd ("D", 1, Date)
END FUNCTION
Function Anytime (thisDate)
Anytime = formatdatetime (cdate (has))
END FUNCTION
Function Daysuntilxmas ()
DaySuntilxmas = Datediff ("D", DATE, CDATE (XMAS))
END FUNCTION
Script>
HEAD>
// Example of Conditional CompiLation
/ * @ cc_on @ * /
/ * @ IF (@_jscript_version> = 5.5)
// Call Function That IS Only Available In Script Engine 5.5
@ELSE @ * /
// alert user thing functionality is inclined in a More Recent version of the script engine
/ * @ END @ * /
Function init ()
{
VAR VER;
// Example of Script Engine Information functions
IF ("undefined" == "" TypeOf scriptenginemajorversion)
Ver = "1"; // function not available Before Version 2
Else
Ver = scriptenginemajorversion () "." scriptengineminorversion ();
}
Script>
HEAD>
Body>
Html>