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