网页制作资料大全.docx

上传人:b****6 文档编号:6892061 上传时间:2023-01-12 格式:DOCX 页数:28 大小:34.30KB
下载 相关 举报
网页制作资料大全.docx_第1页
第1页 / 共28页
网页制作资料大全.docx_第2页
第2页 / 共28页
网页制作资料大全.docx_第3页
第3页 / 共28页
网页制作资料大全.docx_第4页
第4页 / 共28页
网页制作资料大全.docx_第5页
第5页 / 共28页
点击查看更多>>
下载资源
资源描述

网页制作资料大全.docx

《网页制作资料大全.docx》由会员分享,可在线阅读,更多相关《网页制作资料大全.docx(28页珍藏版)》请在冰豆网上搜索。

网页制作资料大全.docx

网页制作资料大全

 

网页制作资料大全

 

1.接收数据库(conn.asp)

<%dimconn,dbpath

setconn=server.CreateObject("adodb.connection")

DBPath=Server.MapPath("db1.mdb")

conn.open"provider=microsoft.jet.oledb.4.0;datasource="&DBpath

%>

2.向数据库里输入

首先接收数据库

<%dimconn,dbpath

setconn=server.CreateObject("adodb.connection")

DBPath=Server.MapPath("db1.mdb")

conn.open"provider=microsoft.jet.oledb.4.0;datasource="&DBpath

%>

或者写成这样的格式:

--#includefile="conn.asp"-->

<%

t1=Request("t1")

t2=Request("t2")

t3=Request("t3")

t4=Request("t4")

t5=Request("t5")

shijian=cstr(date())

conn.Execute"insertintobook(name,lxfs,zy,sex,ncon,dt)values('"&t1&"','"&t2&"','"&t3&"','"&t4&"','"&t5&"','"&shijian&"')"

%>

3.从数据库提取数据

<%

id=Request.QueryString("id")

setrs=Server.CreateObject("adodb.recordset")

rs.Open"select*from表名whereid="&id,conn,1,3

%>

4.读取数据时

在单元格里输入:

<%=rs("字段")%>

5.表格的循环

<%

setrs=Server.CreateObject("adodb.recordset")

rs.Open"select*fromxinwenorderbyiddesc",conn,1,3

fori=1tors.RecordCount

%>……….循环部分…….<%

<%

rs.movenext

next

%>

6.1修改页面(以新闻发布为例)

首先接收数据库<%dimconn,dbpath

setconn=server.CreateObject("adodb.connection")

DBPath=Server.MapPath("db1.mdb")

conn.open"provider=microsoft.jet.oledb.4.0;datasource="&DBpath

%>

注意:

如果数据库和文件不再同一个文件夹里,需要写成:

BPath=Server.MapPath("../db/db1.mdb")【一个小点实现一级跳转】

在body之间加上如下代码:

在表单前<%

id=cint(Request("id"))

setrs=Server.CreateObject("adodb.recordset")

rs.Open"select*from表名whereid="&id,conn,1,3

%>

然后,表单的问号传值如:

id=<%=rs("id")%>">

其次,文本框内的值:

value="<%=rs("字段")%>"

使用在线编辑器加下代码:

id=neirong&style=standard"frameborder="0"scrolling="no"width="600"height="350">

6.2修改写入页面

首先进行权限的判断,在接收数据库

<%

ifsession("qx")<>"1"andsession("qx")<>"2"then

response.write("无权限!

")

else

dimconn,dbpath

setconn=server.CreateObject("adodb.connection")

DBPath=Server.MapPath("db1.mdb")

conn.open"provider=microsoft.jet.oledb.4.0;datasource="&DBpath

%>

然后往数据库写数据(在body之间)

<%

dimid,biaoti,neirong

id=request("id")

biaoti=request("biaoti")

faburen=request("faburen")

neirong=request("neirong")

conn.execute"update表名setbiaoti='"&biaoti&"',faburen='"&faburen&"',neirong='"&neirong&"'whereid="&id

%>

最后<%endif%>

6.3删除页面

<%dimconn,dbpath

setconn=server.CreateObject("adodb.connection")

DBPath=Server.MapPath("zpwz.mdb")

conn.open"provider=microsoft.jet.oledb.4.0;datasource="&DBpath

ifsession("qx")<>"1"then

response.write("无权限!

")

else

id=Request.QueryString("id")

conn.Execute"deletefromxinwenwhereid="&id

response.Write"成功"

endif%>

7查询页面(模糊查询)

7.1先做一个查询的表单,传到接收页

7.2建立一个接受查询的页面如下所示:

<%dimconn,dbpath

setconn=server.CreateObject("adodb.connection")

DBPath=Server.MapPath("news.mdb")

conn.open"provider=microsoft.jet.oledb.4.0;datasource="&DBpath

%>

<%

biaoti=request.Form("t1")

setrs=server.createobject("adodb.recordset")

rs.open"select*fromnewswherebiaoti='"&biaoti&"'orbiaotilike'"&biaoti&"%'orbiaotilike'%"&biaoti&"%'orbiaotilike'"&biaoti&"%'",conn,1,3

ifrs.RecordCount=0then

response.Write"您查询的内容在此没有记录,请输入要查询的正确的信息,谢谢!

"

else

fori=1tors.RecordCount

%>

新闻标题

<%=rs("biaoti")%>

新闻发布人

<%=rs("fbr")%>

新闻发布时间

<%=rs("shijian")%>

新闻内容

<%=rs("neirong")%>

<%

rs.MoveNext

next

endif

%>

8言板制作需要注意的问题

图像读取,在需要显示图像的单元格的代码里输入:

"/>

回复连接:

id=<%=rs("id")%>"

回复页面:

<%dimconn,dbpath

setconn=server.CreateObject("adodb.connection")

DBPath=Server.MapPath("db1.mdb")

conn.open"provider=microsoft.jet.oledb.4.0;datasource="&DBpath

%>

<%

ifsession("qx")="2"then

id=Request("id")

setrs=Server.CreateObject("adodb.recordset")

rs.Open"select*fromzcwhereid="&id,conn,1,3

%>

表单写入:

id=<%=id%>">

<%

else

response.Write"无权限"

endif

%>

接收回复页面:

(1)接收数据库

(2)

<%

ifsession("qx")<>"2"then

response.write("无权限!

")

else

id=Request("id")

huifu=Request("t1")

conn.Execute"updatelysethuifu='"&huifu&"'whereid="&id

response.Write"回复成功!

"

endif

%>

9登陆页面

(1)先建立一个登陆表单

【文本框分别设置为t1,t2,t3】

(2)建立接收登陆页面

1)先接收数据库

2)

<%

name=request.Form("t1")

mima=request.Form("t2")

qx=request.Form("t3")

setrs=server.createobject("adodb.recordset")

rs.open"selectid,name,mima,qxfromyonghuwherename='"&name&"'",conn,1,3

ifrs.recordcount<>0then

ifmima=rs("mima")then

ifrs("qx")="管理员"then

session("qx")="管理员"

session("id")=rs("id")

response.redirect("../admin/guanli.asp")

endif

ifrs("qx")="普通用户"then

session("qx")="普通用户"

session("id")=rs("id")

response.redirect("putongyonghu.asp")

endif

else

response.write("你输入的密码不正确!

")

endif

else

response.write("用户不存在!

")

endif

%>

10管理员页面(普通用户页面同样做法)

<%dimconn,dbpath

setconn=server.CreateObject("adodb.connection")

DBPath=Server.MapPath("../db/zpz.mdb")

conn.open"provider=microsoft.jet.oledb.4.0;datasource="&DBpath

%>

<%

ifsession("qx")="管理员"then

id=session("id")

setrs=Server.CreateObject("adodb.recordset")

rs.Open"select*fromyonghuwhereid="&id,conn,1,3

%>

……….

<%

else

response.Write"<你目前无权限进入本页面>"

endif

%>

10投票系统

(1)投票页面【1.asp】

<%

setconn=server.createobject("adodb.connection")

conn.provider="microsoft.jet.oledb.4.0"

conn.open(server.mappath("toupiao.mdb"))

%>

<%

setrs=server.CreateObject("adodb.recordset")

rs.open"select*fromtoupiaowhereleixing='t'",conn,1,3%>

<%=rs("xiangmu")%>

<%

rs.close

rs.open"select*fromtoupiaowhereleixing<>'t'",conn,1,3%>

<%fora=1tors.recordcount%>

"/>

<%=rs("xiangmu")%>


<%

rs.movenext

next

%>

(2)投票写入页面【2.asp】

<%

setconn=server.createobject("adodb.connection")

conn.provider="microsoft.jet.oledb.4.0"

conn.open(server.mappath("toupiao.mdb"))

%>

…..

<%

dimxianmu,depiao

xiangmu=request.form("xiangmu")

setrs=server.CreateObject("adodb.recordset")

rs.open"select*fromtoupiaowherexiangmu='"&xiangmu&"'",conn,1,3

depiao=rs("depiao")+1

conn.execute"updatetoupiaosetdepiao='"&depiao&"'wherexiangmu='"&xiangmu&"'"

response.redirect("3.asp")

%>

(3)投票比例显示页面【3.asp】

1)接收数据库

2)

<%

dimpiaoshu,depiao

piaoshu=0

setrs=server.createobject("adodb.recordset")

rs.open"selectdepiaofromtoupiaowhereleixing='c'",conn,1,3

fora=1tors.recordcount

piaoshu=piaoshu+rs("depiao")

rs.movenext

next

rs.close

response.Write("总票数为:

"&piaoshu)

%>

项目名称

比例

(1)

(2)

<%

rs.open"select*fromtoupiaowhereleixing='c'",conn,1,3

fora=1tors.recordcount

%>


<%=rs("xiangmu")%>

"bgcolor="#FF0000">

"align="right"bgcolor="#00FFFF"><%=rs("depiao")%>/<%=(piaoshu)%>

<%

rs.movenext

next

%>

 

(4)

向数据库中新增项目【传到xieru.asp】如

新建写入页面【xieru.asp】

<%

dimconn,dbpath

setconn=server.CreateObject("adodb.connection")

dbpath=server.MapPath("toupiao.mdb")

conn.open"provider=microsoft.jet.oledb.4.0;datasource="&dbpath

t1=request.Form("t1")

t2=request.Form("t2")

ift1=""then

response.Write("新增内容无效(错误提示:

新增项目为空),请返回填写新增项目名称...")

else

ift2=""then

t2=0

endif

conn.execute"insertintotoupiao(xiangmu,depiao,leixing)values('"&t1&"','"&t2&"','c')"

response.write("成功!

")

endif

%>

11加入当前日期

相关搜索

当前位置:首页 > 高中教育 > 英语

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1