急需一段用JSCRIPT编写的ASP源代码,麻烦大哥大姐们提供一下
里面包含各种取数据用法,尤其是对SESSION的操作。 问题点数:20、回复次数:19Top
1 楼chonboy(一只来自南方的羊)回复于 2002-11-29 15:43:25 得分 2
Jsp中的session使用
http://www.jdon.com/idea/session.htm
在JSP中访问数据库方法
http://www.ccidnet.com/tech/web/2000/09/20/58_1128.html
jsp连接数据库大全--转贴CSDN之之[希望]大作
http://www.chinaunix.net/bbsjh/14/627.html
用jsp如何读取access数据库
http://school.itnow.com.cn/article/20020530/200205303325.shtmlTop
2 楼wpmsoft(红旗下的蛋)回复于 2002-11-29 16:14:36 得分 0
是ASP耶,不是JSP!!楼上的朋友太粗心了吧。
—————————————————————————————————
★ 与人玫瑰,手有余香 ★
Top
3 楼wpmsoft(红旗下的蛋)回复于 2002-11-29 16:16:04 得分 2
各种取数据用法,不知道是什么概念???????
能否仔细一些。
var a = <%=session("myvar"%>
以上是取session变量的方法。
—————————————————————————————————
★ 与人玫瑰,手有余香 ★
Top
4 楼xuzhi(芝)回复于 2002-11-29 18:15:05 得分 0
不好意思,说的不清楚。我是指用ASP开发网络数据库程序。因为我现在正在开发一个WEB版的管理信息系统,想用Jscript脚本编写ASP,但很多介绍ASP的都是用VBSCRIPT。所以,想要一个用Jscript脚本编写的ASP源代码参考一下。
是ASP耶,不是JSP哦Top
5 楼knightisso(藤井树)回复于 2002-11-30 11:04:00 得分 2
都搞错了。。^_^。。。对Jscript不是很熟悉。主要的是Jscript下面的一些函数和VBscript不一样,应该没有本质区别的。Top
6 楼xuzhi(芝)回复于 2002-11-30 11:16:04 得分 0
BUT WHY??? 在ASP用VBSCRIPT中给变量赋值语句:logid=session("name") 是通过的 。但用JSCRIPT给变量赋值语句 var logid=session("name");就出错了,我有声明变量,也加了分号啊?Top
7 楼junsisi(君三思)回复于 2002-11-30 11:50:46 得分 2
var logid=<%=session("name")%>;
呵呵,asp中的变量在javascript中无法直接读取,你得加上asp标示符<% %>,把变量夹在其中就是了!Top
8 楼xuzhi(芝)回复于 2002-11-30 12:26:05 得分 0
代码本来就是指在服务器端使用的,只不过用的是Jcript。
<%@ language=JScript %>
〈% //取得Session("name")的值并赋给变量 %〉Top
9 楼chonboy(一只来自南方的羊)回复于 2002-12-02 16:08:28 得分 0
呵呵,一失足成千古恨。。。
老了,不中用罗,老眼昏花Top
10 楼runmin()回复于 2002-12-02 16:38:12 得分 6
俺只写一段
<script language="Jscript" runat="server">
var Conn = new ActiveXObject("ADODB.Connection");
Conn.Open("DSN=yourDB;uid=sa;pwd=sa"); //假定连接字符串
Response.Write(Conn);
</script>
或
<%@ language=JScript %>
<%
var Conn = new ActiveXObject("ADODB.Connection");
Conn.Open("DSN=yourDB;uid=sa;pwd=sa"); //假定连接字符串
Response.Write(Conn);
%>
亦或
<%@ language=JScript %>
<%
var Conn = Server.CreateObject("ADODB.Connection");
Conn.Open("DSN=yourDB;uid=sa;pwd=sa"); //假定连接字符串
Response.Write(Conn);
%>
--------------------------------------------------------
<object id=Conn classid="clsid:00000514-0000-0010-8000-00AA006D2EA4" runat="server"></object>
<script language="Jscript" runat="server">
Conn.Open("yourDB");
Response.Write(Conn);
</script>
Top
11 楼runmin()回复于 2002-12-02 16:40:22 得分 2
1.注意大小写;
2.注意连接办法,可以通过Server对象建立ACTIVEX对象,也可以直接通过new ActiveXObject()函数(其实不是函数),建立ACTIVEX对象。Top
12 楼runmin()回复于 2002-12-02 16:41:40 得分 0
还有通过<object>标签建立对象。Top
13 楼chonboy(一只来自南方的羊)回复于 2002-12-02 16:44:55 得分 2
var LogId;
LogId=Session("Name");
Response.Write(LogId);Top
14 楼wgrabob1(飞天)回复于 2002-12-02 19:49:27 得分 0
有没有搞错
这是问题吗?Top
15 楼runmin()回复于 2002-12-02 20:05:50 得分 0
可不可以告诉我什么是问题?Top
16 楼small_pig(小猪)回复于 2002-12-02 23:14:03 得分 2
javascript是客户端的,不能访问数据库的
要是访问也是嵌套了vbscript<%%>
老兄要搞清楚客户端和服务器端Top
17 楼xuzhi(芝)回复于 2002-12-05 09:51:57 得分 0
呵呵,本人刚开始做WEB开发,概念不清,还请多多包含。这里指的JSCRIPT是在服务器端运行的ASP中的脚本。而Javascript是在客户端运行的,嵌入HTML文件的脚本。两者是不同的。Top
18 楼xuzhi(芝)回复于 2002-12-05 09:54:18 得分 0
以下用JSCRIPT编写的代码,如用VBSCRIPT怎么替换?
<%@ language=JScript %>
// 以下是在客户端建立动态树的各函数
var na = new child(); // child object
function child(){
this.total = 0; //孩子节点总数
this.add = add; //添加孩子节点
return this;
}
function add(childnode){
this[this.total] = childnode;
this.total++;
}
function node(name){
this.id = "";
this.name = name;
this.parent = "";
this.child = new child(); //当前节点对象的子节点对象
this.display = true;
this.callstring = "";
na.add(this); //当前节点对象的一个拷贝
}
//显示树
function dispnode(node, deep ,display){
var i;
if (display)
{
Response.Write("<tr><td><table><tr id=" + deep + " >");
for (i=0; i<deep; i++)
{
Response.Write("<td width=16 height=16><img height=16 width=16 src='img/none.gif'></td>");
Response.Write("<td width=16 height=16><img height=16 width=16 src='img/none.gif'></td>");
}
if (node.child.total > 0)
{
if (node.display != false)
Response.Write("<td width=16 height=16><img width=15 height=16 class='open' src='img/open1.gif' id=" + node.id + " onclick='unfold(" + node.id + ")'></td></td><td><img src='img/folder.bmp'></td>");
else
Response.Write("<td width=16 height=16><img width=15 height=16 class='close' src='img/close1.gif' id=" + node.id + " onclick='unfold(" + node.id + ")'></td><td><img src='img/folder.bmp'></td>");
}
else
Response.Write("<td width=16 height=16> <img width=14 height=14 src='img/item.bmp'></td>");
//Response.Write(node.id);
if ( node.callstring != "null"){
Response.Write("<td onmouseup='showmenu()'><font onmouseover=this.style.backgroundColor='#cccccc' onmouseout=this.style.backgroundColor='' style='cursor:hand' id=" + node.id + ">" + "<a href=" + node.callstring + " target='mainFrame'>" + node.name + "</a>" + "</font>" + "</td>");
//Response.Write(node.callstring);
}
else
Response.Write("<td onmouseup='showmenu()'><font onmouseover=this.style.backgroundColor='#cccccc' onmouseout=this.style.backgroundColor='' style='cursor:hand' id=" + node.id + ">" + node.name + "</font>" + "</td>");
if (node.display == false)
display = false;
}
else
{
Response.Write("<tr><td><table><tr id=" + deep + " style='display:none'>");
for (i=0; i<deep; i++)
{
Response.Write("<td width=16 height=16><img height=16 width=16 src='img/none.gif'></td>");
}
if (node.child.total > 0)
Response.Write("<td width=16 height=16><img src='img/open1.gif' id=" + node.id + " onclick='clicknode(" + node.id + "," + node.id + "," + deep + "," + node.display + ")' style='cursor:hand'></td>");
else
Response.Write("<td width=14 height=14><img src='img/item.bmp'></td>");
Response.Write("<td>" + node.name + "<br></td>");
}
Response.Write("</tr></table></td></tr>");
for (i=0; i<node.child.total; i++)
{
dispnode(node.child[i], deep+1, display);
}
}
Top
19 楼chonboy(一只来自南方的羊)回复于 2002-12-05 09:56:58 得分 0
方法上应该是差不多吧
你参照JScript的语法和ASP(VBScript)的方法对象写几个试试看Top




