As far as I know, the only way to mix js variables and VB variables is via
forms (but I'm quite new to all this, only 2 years experience). There is an
article on one of the ASP sites (I forget which) that gives you a taster of
suitable code. To get the details, you have to sign up and pay a fee.
I am strongly in the camp of "help each other out" and have been for the
thirty+ years I have worked in IT. I can write in at least 10 languages, but
I still have to ask questions. I feel it is immoral for programmers or
systems programmers to find answers and hug them to their breasts. But that
is me.
Under normal circumstances, remember clearly that VBScript (usually) is
executed on the server (before your page reaches the browser) and javascript
is executed on the local PC.
Pat (getting long-in-the-tooth and impatient)
----- Original Message -----
From: "DANIEL RADU" <radudanielro@y...>
To: "javascript" <javascript@p...>
Sent: Thursday, August 16, 2001 7:51 AM
Subject: [javascript] Re: about JavaScript / VBScript
> --- avivit@m... wrote:
> > U can access vbscript variables through jscript, and
> > the other way
> > around.I am doing it all the time.
> > I don't know about objects.
> >
> > > I had the time of my life (not really...) when I
> > tried to capture a
> > > vbscript object using javascript. For about 3
> > hours, I twisted and
> > turned
> > > the code, until finally I looked through the
> > documentation for vbscript
> > > and right there in black and white: "you cannot
> > access vbscript objects
> > > from javascript". silly me... But I did succeed
> > in tranfering the data
> > > through a FORM element. smart me...
> > >
> > > My first mistake was TRYING to mix the 2 languages
> > on the same page
> > (using
> > > RUNAT SERVER). I'm still testing the program on
> > my PWS before moving it
> > > to a Public Server.
> > >
> > > Does anyone know whether or not a DNS source can
> > be accessed remotely?
> > By
> > > what method? It's for a message board.
> >
>
> I don't know if it will help you, but you can try
> it!
> I have accessed data stored in a database on a
> server (using either Access drivers, either SQL Server
> drivers). The method is strong using CreateObject (in
> VBScript) or ActiveXObject in JavaScript. And you know
> what? I made a scriptlet (in VBScript, but it works
> fine in JavaScript too), containing all the methods
> and the properties needed to access data.
> The scriptlet is a html file containing only methods
> and properties. It can contain public, get and put
> properties. All public methods and properties are
> declared with the "public_" keyword before their
> names.
> When you call a method you refer it using only its
> name (without "public_").
> An example (in VBScript):
> <SCRIPT LANGUAGE="VBScript">
> Sub public_GetRecordset(strSQL)
> Dim rst
> Dim cnn
> Set cnn = CreateObject("ADODB.Connection")
> cnn.Provider = "SQLOLEDB.1"
> cnn.Open "" 'it will be the connection string
> set rst = CreateObject("ADODB.Recordset")
> rst.Open strSQL,cnn,1,3
> set public_GetRecordset = rst
> end sub
> </SCRIPT>
> Assume this code is in a html page named
> "scriptlet1.htm"
> To call the scriptlet it is necessary to add an
> <OBJECT> in your page.
> Use this:
> <OBJECT id="objData" type="text-x/scriptlet"
> data="scriplet1.htm"></OBJECT>
> On a button (on click), you call the GetRecordset
> method using this (assume the database contain a table
> named "Table1"):
> <SCRIPT LANGUAGE="JavaScript">
> function f(strSQL)
> {
> var rst = new ActiveXObject("ADODB.Recordset");
> file://it will be ok only var rst;
> rst = objData.GetRecordset(strSQL);
> }
> </SCRIPT>
> <INPUT TYPE="button" VALUE="GetRecordset"
> onclick="f('SELECT * FROM Table1')">
>
> I hope it will help you! Good luck!