应用总结:asp编程心得 外文文献译文和原文.doc

约9页DOC格式手机打开展开

应用总结:asp编程心得 外文文献译文和原文,应用总结:asp编程心得 一、数据共享   在某些情形下混合运用vbscript和jscript函数是非常有用的,但在不同语言脚本之间共享数据也可能很有用。实现这种共享的方法很简单:不管使用的是什么语言,只要是在页面级声明的变量就可以任意引用。   对象的使用方法也相似,可以任意选用合适的语言读取、修改属性或调用对象的...
编号:10-207898大小:38.50K
分类: 论文>外文翻译

内容介绍

此文档由会员 wanli1988go 发布

应用总结:ASP编程心得
一、数据共享

  在某些情形下混合运用VBScript和JScript函数是非常有用的,但在不同语言脚本之间共享数据也可能很有用。实现这种共享的方法很简单:不管使用的是什么语言,只要是在页面级声明的变量就可以任意引用。

  对象的使用方法也相似,可以任意选用合适的语言读取、修改属性或调用对象的方法。当然给定对象的属性和方法是由创建该对象实例的语言所定义的。正如上例VBScript的过程调用,当从JScript中调用一个不带参数的VBScript对象的方法时,其调用方法也遵从JScript的调用规则,反之亦然。

二、数组管理

  数组共享问题稍微复杂一点。虽然数组也象其它变量一样可以在不同语言脚本之间共享,但必须注意兼容方面的问题。
VBScript数组在JScript下可以用VBScript的符号引用,即用myArray(2)引用数组元素而不是JScript的数组元素引用符号myArray[2]。此外,还可以使用一个特殊的JScript对象——VBArray对象将VBScript数组转换为JScript数组。下面的代码从VBScript数组myVBArray创建JScript数组myJSArray:
 var Temp = new VBArray(myVBArray)
 var myJSArray
 myJSArray = Temp.toArray()

First, data sharing
In some cases the mixed-use VBScript and JScript function is very useful, but in different languages to share data between the script may also be useful. Achieve this shared approach is very simple: no matter what language is used, as long as the level of the page statement on the variables that can be invoked.

Targeted use similar methods, can be a suitable choice of the language to read, modify or call attributes of the object methods. Of course, given the object properties and methods by which it was created instance, as defined in the language. As the example of the procedure call VBScript, when the call from JScript parameters of a non-VBScript object methods, methods to comply with its call JScript call rules, and vice versa.

Second, the array of management

Array share issue is a little complicated. While the array is the same as the other variables in different languages can be shared between the script, but attention must be compatible with the problem.
VBScript array can be used in JScript VBScript under the symbols used, that is used myArray (2) cited an array JScript elements rather than an array of elements used symbols myArray [2]. In addition, you can use a special JScript object - VBArray VBScript objects will be converted to an array JScript array. The following code from VBScript to create an array myVBArray JScript array myJSArray:
Var Temp = new VBArray (myVBArray)
Var myJSArray
MyJSArray = Temp.toArray ()