当前位置:首页 > 代码 > 正文

asp标签代码(asp表格代码)

admin 发布:2022-12-19 22:23 116


本篇文章给大家谈谈asp标签代码,以及asp表格代码对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

网站ASP 代码 怎么写,

给你个参考例子吧

connection.asp里的代码是:

%

set conn=server.createobject("adodb.connection")

conn.open "provider=microsoft.jet.oledb.4.0;data source="server.MapPath("student.mdb")

%

2.yanzheng.asp里的代码是:

!--#include file="connection.asp"--

%

dim zhanghao,mima

zhanghao=request("zhanghao")

mima=request("mima")

if zhanghao="" then

%

script language=javascript

alert("帐号为空");

location.href="denglu.asp"

/script

% end if %

% if mima="" then

%

script language=javascript

alert("密码为空");

location.href="denglu.asp"

/script

% end if %

%set rs=server.createobject("adodb.recordset")

rs.open "select * from student where zhanghao='"zhanghao"'",conn,1,3

if not rs.eof then

if mima=rs("mima") then

session("zhanghao")=zhanghao

Response.write("scriptlocation.href('index.asp')/script" )

else

response.write ("scriptalert('用户密码错误');location.href('denglu.asp')/script")

end if

end if

if rs.eof then

response.write ("scriptalert('用户帐号错误');location.href('denglu.asp')/script")

end if

set rs=nothing

rs.close

%

二、

conn.asp

 

%

Set conn=Server.CreateObject("ADODB.Connection")

connstr="DBQ="+server.mappath("haha.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)}"

conn.Open connstr

%

 

index.asp

 

%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ""

html

head

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

title无标题文档/title

/head

 

body

form name="form1" method="post" action="login.asp"

table width="50%" height="108" border="0" cellpadding="0" cellspacing="0"

tr

td用户名:/td

tdinput name="us" type="text" id="us"/td

/tr

tr

td密码:/td

tdinput name="pa" type="password" id="pa" value=""/td

/tr

tr

td /td

tdinput type="submit" name="Submit" value="提交"/td

/tr

/table

/form

/body

/html

 

login.asp

 

!--#include file="conn.asp"--

%

us=replace(request.form("us"),"'","’")

pa=replace(request.form("pa"),"'","’")

%

%

set rs=server.createobject("adodb.recordset")

sql="select * from haha where us='"us"' and pa='"pa"'"

rs.open sql,conn,1,1

%

%

if rs.eof or rs.bof then

response.write"密码错误~"

else

response.redirect"main.asp"

end if

%

 

三、

连接数据库(conn.asp)

%

dim db,conn,connstr

db="@data.mdb"

set Conn = server.CreateObject("ADODB.Connection")

connstr="provider=microsoft.jet.oledb.4.0;data source=" server.MapPath("../data/"db"")

conn.Open connstr

%

登录页面(login.asp)

% @language=vbscript %

!--#include file="conn.asp"--

%

On Error Resume Next

dim uid

dim pwd

uid=trim(request.Form("uid")) '获得用户名

pwd=trim(request.form("pwd")) '获得密码

dim rs

set rs=server.createobject("adodb.recordset")

 

if uid"" then

dim sqlstr

sqlstr="select uid,pwd from admin where uid='"replace(uid,"'","''")"' and pwd='"replace(pwd,"'","''")"'"

rs.open sqlstr,conn,3,1

if not rs.eof then

session("uid")=uid

response.redirect "login_ok.asp" '重定位url

else

response.redirect "error.htm"

end if

else

response.redirect "error.htm"

end if

%

asp 这些代码什么意思?

这不是asp代码,只是javascript代码。

可能是插入在asp页面中的,你才误以为是asp代码了

一个asp文件里并不是所有代码都是asp代码,只有在%%这种标签内或script language=".." runat="server"内的才是asp代码.

另外,专业来讲,asp只是一个平台,处理动态页面的一个平台,它可以支持多种程序语言,最常用的是vbscript 和Jscript

下面我就将这些js代码作些注释帮你理解,如果看完还是不懂,建议你加强一下javascript基础,可以到w3scool网站学习

//下面以function开头的是一个函数,代码末尾将这个函数设定在页面下载完毕时运行

function initIt1(){

//这一句是判断当前窗口的名称是idbmainlist时,调用父窗口内的changeColor函数

if(this.name == "idbmainlist"){parent.changeColor('007CD0');}

//下面几句是找到表格列中class不是child并且id不是$Cookies{which}的列并隐藏这些列

tableColl=document.all.tags("tr");

for(i=0; itableColl.length; i++) {

whichEl=tableColl(i);

if(whichEl.className=="child" whichEl.id !="$Cookies{which}"){whichEl.style.display="none";}

}

}

//下面这个函数因为没有看到html代码,我估计是一个展开折叠的代码

//将状态保存在cookie内了

function expands1(el) {

//下面两句获取日期并将年份加1,用于设定cookie时效

expireDate=new Date;

expireDate.setYear(expireDate.getYear()+1);

下面两句获取展开或折叠对应的元素

whichEl1=eval(el+"Child");

whichT1=eval("T"+el);

var wh = (el+"Child");

//下面是分支判断,如果是折叠状态,就运行else之前的代码来展开元素

if (whichEl1.style.display=="none"){

//initIt1();

//更换按钮的图片

whichT1.src="img/NodeOpen.gif";

whichEl1.style.display="block";

document.cookie="which="+wh+";expires="+expireDate.toGMTString()+";";

}else{

//否则折叠对应元素,并更换按钮的图片

whichT1.src="img/NodeClose.gif";

whichEl1.style.display="none";

document.cookie="which="+";expires="+expireDate.toGMTString()+";";

}

}

//设定页面加载完时调用函数initlt1

onload=initIt1;

ASP包含文件代码写在哪里?

!--#include file="数据库连接文件路径"--一般放在文件的最顶部不能放到%%中,注意的是如果有%Option Explicit%的时候,%Option Explicit%在最顶部,!--#include file="数据库连接文件路径"--排第二. 其实一般调用的文件放在一起,只是好管理,好看一些,提高效率,用法是这样的,只要把!--#include file="数据库连接文件路径"--放在你和数据库打交道之前都行的.

ASP网页程序设计中10个非常有用的实例代码

ASP网页程序设计中10个非常有用的实例代码

ASP可以与Web数据库以及其它程序进行交互,是一种简单、方便的编程工具。下面由我带来ASP网页程序设计中10个非常有用的实例代码。

1.如何用Asp判断你的网站的.虚拟物理路径

答:使用Mappath方法: %= Server.MapPath("\")%

2.我如何知道使用者所用的浏览器

答:使用the Request object方法:

3.如何计算每天的平均反复访问人数

答:解决方法

% startdate=DateDiff("d",Now,"01/01/1990")

if strdate 0 then startdate=startdate*-1

avgvpd=Int((usercnt)/startdate) %

显示结果

% response.write(avgvpd) %

that is it.this page have been viewed since November 10,1998

4.如何显示随机图象

% dim p,ppic,dpic

ppic=12

randomize

p=Int((ppic*rnd)+1)

dpic="graphix/randompics/"p".gif"

%

显示

img src=" %=dpic% "

5.如何回到先前的页面

答: a href=" %=request.serverVariables("Http_REFERER")% " preivous page /a

或用图片如: img src="arrowback.gif" alt=" %=request.serverVariables("HTTP_REFERER")% "

6.如何确定对方的IP地址

答: %=Request.serverVariables("REMOTE_ADDR)%

7.如何链结到一副图片上

答: % @Languages=vbscript %

% response.expires=0

strimagename="graphix/errors/erroriamge.gif"

response.redirect(strimagename)

%

8.强迫输入密码对话框

答:把这句话放载页面的开头

% response.status="401 not Authorized"

response.end

%

9.如何传递变量从一页到另一页

答:用 HIDDEN 类型来传递变量

% for each item in request.form %

input namee=" %=item% " type="HIDDEN"

value=" %=server.HTMLEncode(Request.form(item)) % "

% next %

/form

10.怎样才能使得htm文件如同asp文件一样可以执行脚本代码

答:Internet Sevices Manager - 选择default web site - 右鼠键- 菜单属性-〉主目录- 应用程序设置(Application Setting)- 点击按钮 "配置"- app mapping - 点击按钮"Add" - executable browse选择 \WINNT\SYSTEM32\INETSRV\ASP.DLL EXTENSION 输入 htm method exclusions 输入PUT.DELETE 全部确定即可。但是值得注意的是这样对htm也要由asp.dll处理,效率将降低。

;

ASP中.标签代码如何写,高手救命呀`~~~~~~

晕,这种问题也要50啊~~~~~~

理想方法是每页都include一个file

然后在那个文件里面定义

%dim Webname

Webname="站点名称"%

然后每个页面的title都这么写

title%=Webname%/Title

嗨,有什么啊!

不就是正则提取出来替换么!

原来下了几K小说的htm页的时候就处理过了

关于asp标签代码和asp表格代码的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/27455.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载