應(yīng)用總結(jié):asp編程心得 外文文獻(xiàn)譯文和原文.doc
約9頁(yè)DOC格式手機(jī)打開(kāi)展開(kāi)
應(yīng)用總結(jié):asp編程心得 外文文獻(xiàn)譯文和原文,應(yīng)用總結(jié):asp編程心得 一、數(shù)據(jù)共享 在某些情形下混合運(yùn)用vbscript和jscript函數(shù)是非常有用的,但在不同語(yǔ)言腳本之間共享數(shù)據(jù)也可能很有用。實(shí)現(xiàn)這種共享的方法很簡(jiǎn)單:不管使用的是什么語(yǔ)言,只要是在頁(yè)面級(jí)聲明的變量就可以任意引用。 對(duì)象的使用方法也相似,可以任意選用合適的語(yǔ)言讀取、修改屬性或調(diào)用對(duì)象的...
![](http://img.queshao.com/images/pcgzh.gif)
![](http://preview.queshao.com/tobuy/207898.gif)
內(nèi)容介紹
此文檔由會(huì)員 wanli1988go 發(fā)布
應(yīng)用總結(jié):ASP編程心得
一、數(shù)據(jù)共享
在某些情形下混合運(yùn)用VBScript和JScript函數(shù)是非常有用的,但在不同語(yǔ)言腳本之間共享數(shù)據(jù)也可能很有用。實(shí)現(xiàn)這種共享的方法很簡(jiǎn)單:不管使用的是什么語(yǔ)言,只要是在頁(yè)面級(jí)聲明的變量就可以任意引用。
對(duì)象的使用方法也相似,可以任意選用合適的語(yǔ)言讀取、修改屬性或調(diào)用對(duì)象的方法。當(dāng)然給定對(duì)象的屬性和方法是由創(chuàng)建該對(duì)象實(shí)例的語(yǔ)言所定義的。正如上例VBScript的過(guò)程調(diào)用,當(dāng)從JScript中調(diào)用一個(gè)不帶參數(shù)的VBScript對(duì)象的方法時(shí),其調(diào)用方法也遵從JScript的調(diào)用規(guī)則,反之亦然。
二、數(shù)組管理
數(shù)組共享問(wèn)題稍微復(fù)雜一點(diǎn)。雖然數(shù)組也象其它變量一樣可以在不同語(yǔ)言腳本之間共享,但必須注意兼容方面的問(wèn)題。
VBScript數(shù)組在JScript下可以用VBScript的符號(hào)引用,即用myArray(2)引用數(shù)組元素而不是JScript的數(shù)組元素引用符號(hào)myArray[2]。此外,還可以使用一個(gè)特殊的JScript對(duì)象——VBArray對(duì)象將VBScript數(shù)組轉(zhuǎn)換為JScript數(shù)組。下面的代碼從VBScript數(shù)組myVBArray創(chuàng)建JScript數(shù)組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 ()
一、數(shù)據(jù)共享
在某些情形下混合運(yùn)用VBScript和JScript函數(shù)是非常有用的,但在不同語(yǔ)言腳本之間共享數(shù)據(jù)也可能很有用。實(shí)現(xiàn)這種共享的方法很簡(jiǎn)單:不管使用的是什么語(yǔ)言,只要是在頁(yè)面級(jí)聲明的變量就可以任意引用。
對(duì)象的使用方法也相似,可以任意選用合適的語(yǔ)言讀取、修改屬性或調(diào)用對(duì)象的方法。當(dāng)然給定對(duì)象的屬性和方法是由創(chuàng)建該對(duì)象實(shí)例的語(yǔ)言所定義的。正如上例VBScript的過(guò)程調(diào)用,當(dāng)從JScript中調(diào)用一個(gè)不帶參數(shù)的VBScript對(duì)象的方法時(shí),其調(diào)用方法也遵從JScript的調(diào)用規(guī)則,反之亦然。
二、數(shù)組管理
數(shù)組共享問(wèn)題稍微復(fù)雜一點(diǎn)。雖然數(shù)組也象其它變量一樣可以在不同語(yǔ)言腳本之間共享,但必須注意兼容方面的問(wèn)題。
VBScript數(shù)組在JScript下可以用VBScript的符號(hào)引用,即用myArray(2)引用數(shù)組元素而不是JScript的數(shù)組元素引用符號(hào)myArray[2]。此外,還可以使用一個(gè)特殊的JScript對(duì)象——VBArray對(duì)象將VBScript數(shù)組轉(zhuǎn)換為JScript數(shù)組。下面的代碼從VBScript數(shù)組myVBArray創(chuàng)建JScript數(shù)組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 ()