Code shows how to pass server side ASP variables to client side Javascript and then use them in the client side. Very useful in cases where there are less number of refreshes than are required.
<%@ Language=VBScript %>
<% Response.Buffer=true%>
<% 'code by Manikantan
'Web Developer
'3rd Agenda
'Nungambakkam
'Chennai
'India
%>
<%set remoteConn = Server.CreateObject("ADODB.Connection")%>
<% remoteConn.Open "DSN","uid","pwd"%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<SCRIPT LANGUAGE="Javascript">
var arr = new Array()
var arr1 =new Array()
<% sql="select name,e_mail from emptable" %>
<% set rec11=remoteconn.execute(sql) %>
<% counter1=0 %>
<% while not rec11.eof %>
<% response.write "arr" & "[" & counter1 & "]" & "=" & rec11.fields(0)& ";" %>
<% response.write "arr1" & "[" & counter1 & "]" & "=" & rec11.fields(1)& ";" %>
<% counter1=counter1+1 %>
<% rec11.movenext %>
<% wend %>
<% set rec11= nothing %>
</script>
<body>
This page contains an array that can be accessed by javascript...
The array values are populated in the server with server side objects..
</body>
</html>