Ⅰ asp.net 分页代码 首页 上一页 1 2 3 4 5 >> …… 30 下一页 尾页
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="gb2312" >
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<meta name="author" content="Smiling Dolphin" />
<meta name="keywords" content="design, css, cascading, style, sheets, xhtml, graphic design, w3c, web standards, visual, display, java, javascript, c++, php, jsp, asp, py, pl" />
<meta name="description" content="my favorites language." />
<meta name="robots" content="all" />
<title>仿豆瓣分页原型(Javascript版)</title>
<style type="text/css" title="currentStyle" media="screen">
/* Paginator */
.paginator {
font: 14.8px normal Arial, Helvetica, sans-serif;
color: #666666;
margin-top: 10px;
margin-bottom: 5px;
line-height: 150%;
background-color: #EEFFEE;
text-align: center;
}
.paginator a, .thispage, .break {
padding: 2px 4px;
}
.paginator .prev {
margin-right: 20px;
}
.paginator .next {
margin-left: 20px;
}
.paginator .count {
margin-left: 20px;
font-size: 11px;
}
</style>
</head>
<body>
<div id="pagebar" class="paginator"></div>
<script language="javascript" type="text/javascript">
function QueryString(item){
var sValue=location.search.match(new RegExp("[\?\&]"+item+"=([^\&]*)(\&?)","i"))
return sValue?sValue[1]:sValue
}
var count = 56;
var perpage = 20;
var currentpage = QueryString("page");
if (currentpage==null){
currentpage = 1;
}else{
currentpage = parseInt(currentpage);
}
var pagecount = Math.floor(count/perpage);
if(perpage*pagecount!=count)pagecount++;
var pagestr = "";
var breakpage = 9;
var currentposition = 4;
var breakspace = 2;
var maxspace = 4;
var prevnum = currentpage-currentposition;
var nextnum = currentpage+currentposition;
if(prevnum<1) prevnum = 1;
if(nextnum>pagecount) nextnum = pagecount;
pagestr += (currentpage==1)?'<span class="prev">< 前页</span>':'<span class="prev">< <a href="?page='+(currentpage-1)+'">前页</a></span>';
if(prevnum-breakspace>maxspace){
for(i=1;i<=breakspace;i++)
pagestr += '<a href="?page='+i+'">'+i+'</a>';
pagestr += '<span class="break">...</span>';
for(i=pagecount-breakpage+1;i<prevnum;i++)
pagestr += '<a href="?page='+i+'">'+i+'</a>';
}else{
for(i=1;i<prevnum;i++)
pagestr += '<a href="?page='+i+'">'+i+'</a>';
}
for(i=prevnum;i<=nextnum;i++){
pagestr += (currentpage==i)?'<span class="thispage">'+i+'</span>':'<a href="?page='+i+'">'+i+'</a>';
}
if(pagecount-breakspace-nextnum+1>maxspace){
for(i=nextnum+1;i<=breakpage;i++)
pagestr += '<a href="?page='+i+'">'+i+'</a>';
pagestr += '<span class="break">...</span>';
for(i=pagecount-breakspace+1;i<=pagecount;i++)
pagestr += '<a href="?page='+i+'">'+i+'</a>';
}else{
for(i=nextnum+1;i<=pagecount;i++)
pagestr += '<a href="?page='+i+'">'+i+'</a>';
}
pagestr += (currentpage==pagecount)?'<span class="next">后页 ></span>':'<span class="next"><a href="?page='+(currentpage+1)+'">后页</a> ></span>';
document.getElementById("pagebar").innerHTML = pagestr;
</script>
</body>
</html>
Ⅱ asp网站如何在首页添加友情链接的代码
直接写到index.html模板中就行!目录是"/"&sitePath&"templates/"&defaultTemplate&"/"&htmlFilePath&"/index.html"
Ⅲ asp代码注释
session就是全局都可以通用的存放空间。
如session("name")="三毛"
就是把“三毛”赋值给session("name")了
你只要在你的同一站点里的文件都可以得到这个值。
index.asp(管理主界面)程序,代码如下:
<%@language=vbscript%>
<%if not session("checked")="yes" then ‘如果session("checked")不等于yes就直接跳转到login.asp文件.
response.Redirect "login.asp" '直接跳转到login.asp文件
else '反之,就执行下面的end if之前的代码,
%>
<html>
<head>
<title>管理界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<frameset cols="167,*" frameborder="YES" border="1" framespacing="1" rows="*" bordercolor="#666666">
<frame name="leftFrame" scrolling="auto" noresize src="left.asp">
<frame name="mainFrame" src="right.asp">
</frameset>
<noframes>
<body bgcolor="#FFFFFF" text="#000000">
</body>
</noframes>
</html>
<%end if%>
login.asp://登陆系统程序中的一段
<span class="font">密 码:</span>
<input type="password" name="password" class="text" size="20" onMouseOver="this.focus()">
<%if session("check")="wrong" then response.Write "<br><span class='font'><font color=red>验证错误!</font></span>" end if%> ‘如果session("check")等于wrong这个字符串就输出,验证错识这几个字.
check.asp://核对输入的用户和密码是否正确
<%
dim name,password
'定义 name,password
name=request.form("name") '把取得name表单的值赋值给name变量。
password=request.form("passw
ord") ‘'把password表单的值赋值给password变量
dim exec,conn,rs
'定义 exec,conn,rs
exec="select *from check where(name='"&name&"' and password='"&password&"')"
'check表中name的值等于上面表单中接收到的name值,和password等于上面接收到的request.form("password")值,符号要求的表中的所有字短赋值给exec变量.
set conn=server.createobject("adodb.connection") '建立数据库连接
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("admin.mdb") ‘打开连接数据库
set rs=server.createobject("adodb.recordset") '建立集
rs.open exec,conn '打开数据库 rs.open exec,conn,1,1
if not rs.eof then '如果数据库中不是第一个记录的话
rs.Close '关闭集合
conn.Close '连接文件关闭,
session("checked")="yes" ‘把YES字符串赋值给session("checked")
session("check")="right" '把right赋值给session("check")
response.Redirect "index.asp" '直接跳转到index.asp文件
else '反之,就是数据库中有多条记录的话,
session("checked")="no" ‘把no字符串赋值给session("checked")
session("check")="wrong" '把wrong字符串赋值给session("checked")
response.Redirect "login.asp" '直接跳转到login.asp文件
end if
%>
left.asp://管理导航
<%@language=vbscript%>
<%if not session("checked")="yes" then '如果session("checked")的值不是yes的话.
response.Redirect "login.asp" '跳转到login.asp页面
else ‘反之,执行下面的一些html代码
%>
<html>
<head>
<title>管理界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body text="#000000" topmargin="0" bgcolor="#ffffff" leftmargin="10">
<div align="center"><a href="index.asp" target="_parent"><br>
<br>
管理界面首页</a> <a href="exit.asp" target="_parent">退出</a><br>
<br>
</div>
</body>
</html>
<%end if%>
exit.asp://退出系统
<%@language=vbscript%>
<%
session("check")="" '这些就没有意义了,没if就空值直接跳转
session("checked")=""
response.redirect "login.asp" 'if session("check")="" or session("checked")="" then
response.redirect"login.asp"
end if
%>
right.asp://具体管理的内容
<%@language=vbscript%>
<%if not session("checked")="yes" then 'session("checked")等于yes跳转到login.asp页面
response.Redirect "login.asp"
else
%>
<html>
<title>管理界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#ffffff" text="#000000" topmargin="20" class="title">
这里是网页教学网的管理系统示例!请大家多研究使用!
</body>
</html>
<%end if%>
Ⅳ asp注册登陆代码
如果有需要可以Hi我.网上的代码我没用过,我想一般不会有太多的错误吧,可能是操作上的原因.呵呵
Ⅳ 求一个:最简单的asp登陆界面代码
<form id="form1" name="form1">
用户名:<input type="text" id="UserName" name="UserName">
密 码:<input type="password" id="PassWord" name="PassWord">
<input type="button" value="提交" onclick="javascript:if
(document.all.UserName.value!='suchen' && document.all.PassWord.value!
='suchen'){alert('用户名或密码有误!')}else
{location.href='http://hi..com/ken_fly';}">
</form>
因为你没有数据库的,所以其实用这个就行了,不用那么麻烦,
把“suchen"和那个http://hi..com/ken_fly改为你想要的就行。
呵呵。把它复制到别的地方比较看得清。这里这个宽度太小,不好看!
设计的话,要你自己根据你的页面设计,在这里我就帮不了你了,只能给你源码。呵呵!
Ⅵ 用ASP制作登陆页面的代码
时间关系,没给你写 所以就复制了一段 可到我论坛看看
http://forum.liehuo.net/
代码如下:
1.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("<script>location.href('index.asp')</script>" )
else
response.write ("<script>alert('用户密码错误');location.href('denglu.asp')</script>")
end if
end if
if rs.eof then
response.write ("<script>alert('用户帐号错误');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" "http://www.w3.org/TR/html4/loose.dtd">
<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>
<td><input name="us" type="text" id="us"></td>
</tr>
<tr>
<td>密码:</td>
<td><input name="pa" type="password" id="pa" value=""></td>
</tr>
<tr>
<td></td>
<td><input 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
%>