怎样在下面3个页面中加入控制图片上传总数量的程序?[问题已解决,感谢wangjy500老师]
后编辑页面(cp-hbj.asp):<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn.asp" -->
<!--#include file="../wzjs/glyfw.js" -->
<%
Set ad = Server.CreateObject ("ADODB.Recordset")
sql = "Select * from cpzs ORDER BY id DESC"
ad.Open sql,conn,1,1
%>
<!--#include file="hbjymfy.js" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE2 {
font-size: 24px;
font-weight: bold;
color: #0000FF;
}
.STYLE3 {font-size: 12px}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.STYLE5 {font-size: 16px}
-->
</style>
<style type="text/css">
<!--
.cf {
float: left;
}
.STYLE6 {color: #FF0000}
.STYLE7 {color: #FFFFFF}
-->
</style>
</head>
<body>
<table width="780" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="40" colspan="2" align="center" bgcolor="#00FFFF"><span class="STYLE2">产 品 展 示 后 台 编 辑 <span class="STYLE5 STYLE7"> <a href="http://pic. target="_blank">图片在线处理</a></span></span></td>
</tr>
<tr>
<td width="580" height="30" align="center" class="STYLE5">[
<%
if not ad.eof then%>
<a href="cp-htj.asp?id=<% =ad("id")%>"><strong>添 加</strong></a>
<%else%>
<a href="cp-htj.asp"><strong>添 加</strong></a>
<% end if%>
] </td>
<td width="200" align="center" class="STYLE5"><span class="STYLE3">当前共有<span class="STYLE6"> <%=ad.recordcount%> </span> 张产品图片 </span></td>
</tr>
<tr>
<td height="25" colspan="2" align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="11" height="580" valign="top" background="images/aa.jpg"></td>
<td align="center" valign="top"><p><span class="STYLE25"><span class="px16"></span></span></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
</table>
<%
if ad.EOF and ad.BOF then
response.write"暂时图片"
else
Dim iPage
For iPage=1 To ad.Pagesize %><!分页循环代码开始>
<table width="140" height="150" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC" class="cf">
<tr>
<td height="90" colspan="2" align="center">
<img src=<%=ad("pic")%> width="90" height="120" border="0" style="cursor:pointer;BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 8px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 8px; PADDING-BOTTOM: 8px; BORDER-LEFT: #cccccc 1px solid; PADDING-TOP: 8px; BORDER-BOTTOM: #cccccc 1px solid;"></td>
</tr>
<tr>
<td height="30" colspan="2" align="center"><%=ad("bt")%></td>
</tr>
<tr>
<td width="70" height="25" align="center" class="STYLE3"><span class="STYLE1"><a href="cp-hxg.asp?id=<%= ad ("id") %>">修 改</a></span></td>
<td width="70" align="center" class="STYLE3"><a href="cp-hsc.asp?id=<%= ad ("id") %>">删 除</a></td>
</tr>
</table>
<% ad.MoveNext
if ad.eof then exit for
Next
end if
%><!分页循环代码结束>
<p><!--#include file="hbjfyxs.js" -->
</p>
</table ></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<% conn.close '关闭连接,
set conn=nothing '释放内存 这两句很重要,不然会占用大量服务器资源
%>
后添加页面(cp-htj.asp):
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn.asp" -->
<!--#include file="../wzjs/glyfw.js" -->
<% '栏目内容查询
Set rs= Server.CreateObject ("ADODB.Recordset")
sql = "Select * from cpzs"
rs.Open sql,conn,1,1
%>
<style type="text/css">
<!--
.STYLE1 {
font-size: 24px;
color: #0000FF;
}
.STYLE3 {
color: #FF0000;
font-weight: bold;
font-size: 12px;
}
.STYLE8 {color: #999999; font-size: 12px; }
-->
</style>
<form action="cp-htjzx.asp" method="post" name="form1" target="_self">
<table width="780" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="40" colspan="2" align="center" bgcolor="#00FFFF"><span class="STYLE1">产 品 图 片 添 加</span></td>
</tr>
<tr>
<td width="200" height="30" align="right">图片标题:</td>
<td> <input name="bt" type="text" id="bt" size="50">
<span class="STYLE3">※ 必填! </span></td>
</tr>
<tr>
<td height="30" align="right">链接网址:</td>
<td>
<input name="url" type="text" id="url" size="50">
<span class="STYLE8">※</span> <span class="STYLE8">选填</span> </td>
</tr>
<tr >
<td height="30" align="right">图片上传路径:</td>
<td> <input name="pic" type="text" id="pic" size="50">
<span class="STYLE8">※ 不用填,由上传时自动获得!</span></td>
</tr>
<tr >
<td width="200" height="30" align="right">上传图片:</td>
<td valign="middle"> <iframe src="bjq.asp?action=swf_Pic" width="300" marginwidth="0" height="25" marginheight="0" align="middle" scrolling="no" frameborder="0"></iframe>
<span class="STYLE3">※ </span><span class="STYLE8">先点击"浏览",然后"上传",最后点"添加". </span></td>
</tr>
<tr>
<td height="40" colspan="2" align="center" bgcolor="#FFFFFF"><input type="submit" name="Submit" value="添 加"></td>
</tr>
</table>
</form>
<%
conn.close '关闭连接,
set conn=nothing '释放内存 这两句很重要,不然会占用大量服务器资源
%>
后添加执行页面(cp-htjzx.asp):
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn.asp" -->
<!--#include file="../wzjs/glyfw.js" -->
<%
bt=request("bt")
pic=request("pic")
url=request("url")
if bt="" then
response.write("<script>alert('标题不能空');window.history.back();</script>")
response.end() '结束运行
end if
if pic="" then
response.write("<script>alert('请上传图片!');window.history.back();</script>")
response.end() '结束运行
end if
conn.execute("insert into cpzs([bt],[pic],[url]) values('"&bt&"','"&pic&"','"&url&"')")
'添加到数据库注册完成,yhgl_pwd是ACCESS中的保留关键字。
response.write("<script>alert('添加成功!');location.href='cp-hbj.asp'</script>")
conn.close '关闭连接,
set conn=nothing '释放内存 这两句很重要,不然会占用大量服务器资源。
%>
[ 本帖最后由 tepnidh 于 2012-2-25 17:58 编辑 ]