Hi Elizabeta,
It should be the other way around: you shouldn't move the script
delimiter, but you should move the array declaration.
Here is the offending part rewritten:
Dim objCmd, strSql, rs
%>
<script language="javascript">
var myArray = new Array(); // this is client side, so outside <% and %>
<%
'this is where I'm getting an error "Expected end of statement,
'but I'm sure it's not the statement itself that is
'the problem but the way I place it in the document.
set objCmd = Server.CreateObject("ADODB.Command")
' etc etc
%>
HtH
Imar
> I do have EOF statement and if I move the <% above the <SCRIPT
> delimeters It gives me an error that it can't recognize <SCRIPT ...
> JavaScript> tag.
>
> -----Original Message-----
> From: Imar Spaanjaars [mailto:Imar@S...]
> Sent: Monday, November 12, 2001 2:08 AM
> To: JavaScript HowTo
> Subject: [javascript_howto] Re: Combining JavaScript and ASP
>
> Hi Elizabeta,
>
> You are mixing up client side JavaScript and server side VB Script.
>
> The default language for your server side page is VBScript (<%@
> Language=VBScript %>), but then you start a client side JavaScript tag.
> Inside that tag you are writing JavaScript dynamically (which is a legal
>
> way to do it) with VBScript, but "var myArray = new Array(); ", the
> first
> line inside the <% %> delimiters is still JavaScript. Move that line up
> (before the opening <%) and it should work.
>
> Also, you may need to check for EOF. Right now, you just assume that the
>
> recordset contains records, which may or may not be the case.
> Change it to something like this:
>
> If Not rs.EOF then
>
> Do Until rs.EOF
>
> Response.Write "myArray["
>
> Response.Write rs("INDEPENDENT_ID") & "] = """
>
> Response.Write rs("NAME")
>
> Response.Write """;" & vbCrlf
>
> rs.MoveNext
>
> Loop
>
> End If
>
> If the only purpose of the JavaScript is to get a combo box with data,
> you
> can also write a straight HTML <select> tag inside the loop of your
> recordset.
>
>
> HtH
>
> Imar
>
>