|
-
Jul 17th, 2000, 02:38 AM
#1
Thread Starter
Addicted Member
to create a object in VBScript i write the next code:
<%
set rs = server.CreateObject("ADODB.Recordset");
set OBus =server.CreateObject
("TreeBusiness.clsTreeBusiness");
call OBus.InitializeLogin
("10.10.10.8","project_liron","sa","sa");
%>
how can i do the same in JavaScript ?
The MORE I get to know,
I realize that I know NOTHING !
-
Jul 17th, 2000, 04:40 AM
#2
Fanatic Member
Hi Lirlir
Chack out this site. It tells you all about objects in javasvript.
http://wsabstract.com/javatutors/object.shtml
or
http://www.javaworld.com/javaworld/j...ascript-2.html
Ian
[Edited by Ianpbaker on 07-17-2000 at 05:43 AM]
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Jul 17th, 2000, 05:23 AM
#3
Thread Starter
Addicted Member
Thanks saver !!!
but if u can give me an example.
like in VBS it is: set x= server.createobject
("ADODB.Recordset")
and in JS it is : ???????????????????????
lirlir
The MORE I get to know,
I realize that I know NOTHING !
-
Jul 17th, 2000, 05:35 AM
#4
Fanatic Member
If I remember correctly, if you want to use databases that way you need to use pearl/CGI which I don't know. The problem if you could use javascript with databases is that All the js is run client side. So you would need a database on every computer in the same place that was looking at your site. So as you can probably tell it's not worth it if you could do it.
Also, if your fairly happy using ASP, pearl/CGI is basically a different way of having server side script like ASP
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Jul 17th, 2000, 05:42 AM
#5
Thread Starter
Addicted Member
The thing is that I want to create the tree based on a table with the tree properties.(key,parent,caption,link,level,islast{for pages only}).
I already created the tree and the table with the mentioned fields, and a .dll to handle the tree table (the table is on a SQLServer).
So far so good !!! (I hope that u understand me)
I have a few problems :
1. I don’t know if I can use VBS and JS in the same asp/html page.
2. if it isn’t possible than , I don’t know how to create an object on JavaScript
I hope u can help me with my problem.
My version for ix_js : including BuildTree function (JS) and on top of the source code the definitions of the objects.(ADODB,TreeBusiness{my .dll})
The next is placed at the top of the code as VBS :
<%
set rs = server.CreateObject("ADODB.Recordset");
set OBus =server.CreateObject("TreeBusiness.clsTreeBusiness");
call OBus.InitializeLogin("10.10.10.8","project_liron","sa","sa");
%>
The next is placed at the JS Block as JS :
BuildTree("RP",0);function BuildTree(node , level)
{
rs =new OBus.GetNodes("Parent='" & cstr(node) & "'");
if (!(rs.EOF) && !(rs.BOF))
{
while (!(rs.EOF))
{
if (level==0)
{ initTree(rs.fields("Caption"),rs.Fields("NKey"),rs.Fields("Link")); buildTree(rs.Fields("NKey"),level+1); rs.movenext
lastPage("My Helper","c","help.htm"); end_Tree(); }
else
{ if ((level==1) || (level==2)) {
sub_Book(rs.fields("Caption"),rs.Fields("NKey"));
buildTree(rs.Fields("NKey"),level+1);
end_Book();
rs.MoveNext;
} else
{
if ((level==3) && (rs.fields("IsLast")==0))
{ sub_Page(rs.fields("Caption"),rs.Fields("NKey"),rs.Fields("Link"));
rs.MoveNext ;
} else if ((level==3) && (rs.fields("IsLast")==1))
{
lastPage(rs.fields("Caption"),rs.Fields("NKey"),rs.Fields("Link")); rs.movenext }
}
} } }
}
The MORE I get to know,
I realize that I know NOTHING !
-
Jul 17th, 2000, 05:51 AM
#6
Fanatic Member
I Sort of understand
unfortunatly You can't embedd any asp Tags within a script tag e.g
<SCRIPT language=Javasctipt>
alert("<% = recordset("NAME")%>");
</SCRIPT>
Will completly fall arse over tit.
But you can build you script block using response.write. You have to be very careful though to get the layout right or you will get lots of script errors.
response.write "<SCRIPT language=Javasctipt>" & vbnewline
response.write "alert('" & recordset("NAME") & "'); & vbnewline
response.write "</SCRIPT>
Hope this is of help
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Jul 17th, 2000, 05:55 AM
#7
Thread Starter
Addicted Member
hey Ian
i will try that 1
when i m done i ll tell u
thank
lirlir
The MORE I get to know,
I realize that I know NOTHING !
-
Jul 17th, 2000, 11:53 AM
#8
Hyperactive Member
Doesnt this work?:
var x= server.createobject("ADODB.Recordset");
"People who think they know everything are a great annoyance to those of us who do."
-
Jul 18th, 2000, 12:56 AM
#9
Thread Starter
Addicted Member
The MORE I get to know,
I realize that I know NOTHING !
-
Jul 18th, 2000, 02:45 AM
#10
Fanatic Member
Hi Noone
As I said earlier, you have the problem that the javascript runs on the client machine and not on the server, so getting to the database is impossible. You might be able to use the runat=Server in the script tag, it could work but then how would you get to pass it to the client side javascript to use with the tree view code. I've never tried this before and I doubt very much that it would work.
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Jul 18th, 2000, 01:45 PM
#11
Hyperactive Member
Ohh sorry, I didnt realise he wanted the JS to run client side. I thought it was going to run server side on an ASP page.
"People who think they know everything are a great annoyance to those of us who do."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|