VBScript and JScript interaction in ASP page
ASP is able to manage scripts in different languages, automatically invoke the appropriate script engine to interpret the script code and execute predefined functions. ASP development environment provides two script engines: VBScript (the default) and JScript.
1. VBScript and JScript in the built-in functions
In the VBScript and JScript, there are a large number of built-in function are the same or similar. However, in a scripting language built-in function is not always in another scripting language also has a corresponding function. For example, VBScript provides a number of strings and format data for the operation of the functions that does not exist in JScript. These functions include StrReverse (), Filter () and FormatCurrency () and so on. On the other hand, JScript provides for management of arrays, strings, a function of coding is also not defined in VBScript, such as join (), reverse (), pow (), bit manipulation, escape () and unescape () and so on.
So, how to do if need a VBscript JScript function of the program?
2. Different scripts invoke heterogeneous
If need to invoke a built-in functions of VBScript in JScript, it should be written a VBScript that user defined function (here invoke VBScript built-in function), then as common as invoking the user defined function in JScript. For example, if you want to invoke VBSCript built-in function is FormatCurrency (), you can state the following custom function:
Then the code in JScript function to be as common as invoking FormatValue (). A similar method can also be used to achieve VBScript code to JScript.Apply the same rules, we can invoke script in any user-defined functions.
3. Data sharing
In some cases, mixed-use VBScript and JScript function is very useful, but in different languages to share data between scripts may also be useful. Achieve this shared approach is very e: no matter what language to use, as long as the page-level statement of the variable can be any references.
Object is using similar methods, you can choose any appropriate language to read, modify object properties or invoke. Certainly, it is defined by the language that given object properties and methods to create the object instance.