473,326 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Back to Basics


How to i pass an asp array to a client side vbscript array ?

Thanks

John
Jun 18 '07 #1
2 1293
John Peach wrote on 18 jun 2007 in microsoft.public.inetserver.asp.general:
How to i pass an asp array to a client side vbscript array ?
Assuming serverside vbs and an array of strings:

<script type = 'text/vbscript'>
dim a(17)
a(0) = "<% = a(0) %>"
a(1) = "<% = a(1) %>"
a(2) = "<% = a(2) %>"
a(3) = "<% = a(3) %>"
'' .....
</script>

or

<script type = 'text/vbscript'>
dim a(17)
<%
for i = 0 to 17
%>
a(<% = i %>) = "<% = a(i) %>"
<%
next
%>
</script>

or

As a string by using join() and split()

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 18 '07 #2
On Mon, 18 Jun 2007 04:25:40 -0500, John Peach <jo********@zen.co.uk
wrote:
How to i pass an asp array to a client side vbscript array ?
If you're careful, one way would be to take a page from JSON and return
the data as VBScript source:

<% Option Explicit

Randomize
Dim a: a = Array(Fix(Rnd * 100), Fix(Rnd * 100), Fix(Rnd * 100))
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<title>Test</title>
<script language="vbscript">
Option Explicit

Function DisplayData(values)
Document.GetElementById("output").InnerHTML = Join(a, ", ")
End Function
</script>
<body>
<div id="output"></div>
<script language="vbscript">
Option Explicit

Dim a: a = Array(<%= Join(a, ", ") %>)
DisplayData(a)
</script>
</body>

--
Justin Piper
Bizco Technologies
http://www.bizco.com/
Jun 18 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

72
by: Mel | last post by:
Are we going backwards ? (please excuse my spelling...) In my opinion an absolute YES ! Take a look at what we are doing ! we create TAGS, things like <H1> etc. and although there are tools...
1
by: manish | last post by:
Hi, I am a fresher in the programming field i.e although I have done programming at the basic level but at professional level I am very new and I am facing many problems. These probllems are...
2
by: Phil | last post by:
I have the following code but do not know the best way to return the updated DataTable back to the database. I believe I can use the Update method of the Data Adapter, BUT if true, I also believe I...
1
by: RC | last post by:
I have an Access 2002 database with many tables and forms (but just to keep things simple, let's say the DB has one Table "Table1" and one Form "Form1"). I have managed to cobble together so much...
14
by: chitu | last post by:
Hi pals, Hope u all of r intersted in C programming.Let start from d basics.
3
Mague
by: Mague | last post by:
Hey, I need help to some how open a exe file with Microsoft Visual basics. You mite think im trying to steal someone elses project but im not i wont to no how they did it and upgrade it if...
20
by: Prisoner at War | last post by:
Hi, People, Is it possible to have an "empty" or "dummy" <a href***without*** the browser jumping back up the page?? I have a hyperlink that doesn't point to another document, but is used to...
0
by: babu8880 | last post by:
www.convensysglobal.com/elearn You can login and attend courses and similar resources ask your doubts from experienced engineers in iphone and Objective C Domain You can attend live classes...
23
by: artur223 | last post by:
Hello, I have a problem with IF(IIf) statement in query expression builder(criteria field). It should be like : If !! = "" then criteria field should be filled ! else criteria field should be...
2
Lookin4Toons
by: Lookin4Toons | last post by:
Trying to create a text box w/user input to enter a suggested user name and query AD to see if the name is available. This is for HR users who do not have access to the Admin tools to open the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.