 |
试一下在JavaScript中使用Object。JavaScript使用Object作为参考(as reference).如同VB中的"ByRef"。
//Sample codes
function Rect(long initLeft, long initTop, long initRight, long initBottom)
{
this.left = initLeft;
this.top = initTop;
this.right = initRight;
this.bottom = initBottpm;
//may be other functions if you like
//…
}
//init
var myRect = new Rect(0,0,10,10);
//call here
GetXRect(myRect);
//In the function GetXRect(), you can set myRect.left, … to the values as you want.
//in the final, if myRect is not used anymore, set myRect = null is recommended.
Hope this message can help you.
此问题由Steve回答。
附加关键字:编程, 源程序, programming, source code, 其他语言, asm, vba, vbscript, C/C++, MFC, C++ Builder, Borland C++, Turbo C, C, BCB, ActiveX技术, activex, com, ado。
|