Re: Arrays in VBScript
From: Roland Hall (nobody_at_nowhere)
Date: 05/31/04
- Next message: John: "Re: IrDa with Winsock or IComm question"
- Previous message: John: "IrDa with Winsock or IComm question"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 31 May 2004 05:51:32 -0500
"Bob" wrote in message news:155a301c446b7$60d3a8a0$a401280a@phx.gbl...
: Unlike VBScript, the arrays in Javascript are objects that
: have methods and properties. The following example defines
: an array in Javascript. How can I achieve the same in
: VBScript? Can someone convert the following function
: (arrayTest ()) defined in Javasctipt to its equivalent in
: VBScript and/or in VB6?
:
: To understand the function, create an HTML file with the
: following and open the file:
:
: Thanks in advance,
: Bob
:
: <html>
: <head>
: <script language="javascript">
: function arrayTest()
: {
: var i;
: symbols = [{person:"Bob", age:"26",
: gender:"male"}, {person:"Amy", age:"23",
: gender:"female"}]
:
: alert(symbols.length);
: for (i=0; i<symbols.length; i++)
: {
: alert(symbols[i].person);
: alert(symbols[i].age);
: alert(symbols[i].gender);
: }
: }
: </script>
: </head>
: <body onload="arrayTest()">
: Testing for Arrays in javascript
: </body>
: </html>
Hi Bob...
This appears to be an associative array. VBScript has associative arrays,
called dictionaries but, AFAIK, they cannot be indexed so this might be a
little more difficult. There may be a better alternative. My example
requires a unique format of the data to follow your theme.
I didn't put this in ASP so it requires IE to run it.
http://kiddanger.com/lab/bob/arrays.html
HTH...
-- Roland Hall /* This information is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. */ Technet Script Center - http://www.microsoft.com/technet/scriptcenter/ WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp MSDN Library - http://msdn.microsoft.com/library/default.asp
- Next message: John: "Re: IrDa with Winsock or IComm question"
- Previous message: John: "IrDa with Winsock or IComm question"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|