I think you need to differ between Server Side Code and Client Side Code.
Server side code is like ASP for example and it runs prior that page sent to
the client
Client side executed on the client only and have no interaction with server.
Oleg.
-----Original Message-----
From: James Sharrett [mailto:jsharrett@c...]
Sent: April 18, 2002 3:37 PM
To: javascript
Subject: [javascript] RE: database connection error
Ok. I changed the extension to ASP and that has cleared the error but now
the rest of the code has stopped working. The function I'm using is part
of an API for some other objects on the page. I'm reloading the objects
after the code changes. ASP is only run when the page first loads so
would this stop the remaining code from working as changes are made to the
page?
> first of all you have to make it as ASP or JSP cause what you trying to
do
is to execute server side code.
And this server side code have to be processed by Web Server
so you have decide either on ASP or JSP and put it into web server..
otherwise it wont work the way you want it to work.
Oleg.
-----Original Message-----
From: James Sharrett [mailto:jsharrett@c...]
Sent: April 18, 2002 3:22 PM
To: javascript
Subject: [javascript] RE: database connection error
I have it as an HTM file. I'm running it from my PC which is both the
client and server.
> Is it HTM or ASP file ?
What extension does it have ?
And where are you running it from you local computer as regular HTML file
or from WEB server ?
Oleg.
-----Original Message-----
From: James Sharrett [mailto:jsharrett@c...]
Sent: April 18, 2002 3:11 PM
To: javascript
Subject: [javascript] database connection error
I'm trying to create a connection to a database but I'm getting an error
on the first step where I'm creating the connection object. Below is the
code in the page.
<%@ LANGUAGE = JavaScript%>
<script language="JavaScript" runat="Server">
function Grid_memberChanged( dim, mem )
{
var hDimU, hOffGridMbrU, UnitName
var hDimP, hOnGridMbrP, ProdName, hAllProd
var objConn, objRS, sQuery, objField
<<<<SNIP>>>>>
objConn = Server.CreateObject("ADODB.Connection");
objConn.Open ("DSN=CTrain");
sQuery = "Select Product from Ctrain.UnitTable where Unit = '" + UnitName
+"'"
objRS = objConn.Execute(sQuery);
<<<<SNIP>>>>>
}
Everything in the code works fine except the database connection. When I
page (.htm) calls the function with the database connection code I get the
following error "Server is Undefined". If I take out Server., I get an
error that says object expected.
I'm running this from my pc which is both the client and server. The ODBC
connection works fine and the database is on my PC.
What am I missing?
Thx,
James
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20