图片修改名称问题?高手帮忙看下代码错在哪了?
这是图片的主要代码?不知哪错了,点击修改按钮没有反应?删除按钮可以删掉图片。高手帮帮忙,谢谢了!我想在后台可以修改名称。规格。两个项目!
<% dim rs,sql,page,i,NewsTitle,cpgg,ProName,NewsTitle2
sql="select ProAddress,ProName,ID,NewsTitle2,cpgg from Product order by id desc "
Set rs = Server.CreateObject ("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof then
response.write("<tr><td colpan=""4"">暂无图片</td></tr>")
rs.pagesize=15
else
page=Request.QueryString("page")
rs.PageSize = 15
if Not IsEmpty(page) then
if Not IsNumeric(page) then
page=1
else
Page = cint(page)
end if
if Page > rs.PageCount then Page = rs.PageCount
if Page <= 0 then Page = 1
else
Page = 1
end if
rs.AbsolutePage = Page
For i = 1 to rs.PageSize
if rs.EOF then Exit For
%>
<td height="160" align="center" valign="middle">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="tdbg"><img height="100" width="126" border="0" src=<%=rs(0)%>></td>
</tr>
<tr><br>
<tr><td height="20" align="center" >
名称:<input name="NewsTitle2" type="text" id="Title" value="<%=rs(3)%>" size="15" maxlength="50"></td>
</tr>
<tr><td height="20" align="center" >
规格:<input name="cpgg" type="text" id="Title" value="<%=rs(4)%>" size="15" maxlength="50"></td>
</tr>
<tr>
<td height="20" align="center">
<input name="Submit2" onClick="if(confirm('确定删除?'))DeleteData(<%=rs(2)%>)" type="button" id="Submit" value="删除" />
<input name="Submit" onClick="UpdateData(0)" type="button" id="Submit" value="修改"><input type="hidden" name="NewsFile" value="0"><input name="IsFile" type="hidden" value="0" /></td>
</tr>
</table>
</td>
<%
if i=5 or i=10 then
response.write("</tr><tr>")
end if
rs.movenext
next
end if
%>
</tr>
<tr>
<td> PAGE: <a href="admin_pic.asp?page=1">1</a><% for i=2 to rs.pagecount %>
| <a href="admin_pic.asp?page=<%=i%>"><%=i%></a>
<% next %></td>
</tr>
</table>
</body>
</html>
<script language="javascript">
function DeleteData(ID)
{
var postInfo = "PostType=Products&Actions=Delete&ID="+ID;
var eZuStudio = new ActiveXObject("Microsoft.XMLHTTP");
eZuStudio.open("POST","PostData.asp",false);
eZuStudio.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
eZuStudio.send(postInfo);
alert(unescape(eZuStudio.responseText));
window.location.reload();
}
</script>
<script language="javascript">
function UpdateData(IsFile)
{
var NewsTitle2=escape(document.all.NewsTitle2.value);
var cpgg=escape(document.all.cpgg.value);
var ProType=escape("<%=ProType%>");
var postInfo = "PostType=News&Actions=Modify";
postInfo=postInfo+"&NewsTitle2="+NewsTitle2+"&cpgg="+cpgg+"&ProType="+ProType;
postInfo=postInfo+"&ID=<%=ID%>";
var eZuStudio = new ActiveXObject("Microsoft.XMLHTTP");
eZuStudio.open("POST","PostData.asp",false);
eZuStudio.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
eZuStudio.send(postInfo);
alert(unescape(eZuStudio.responseText));
window.location.href="Admin_Pic.asp?ProType="+ProType;
}
</script>
//////////////////////////PostData.asp中主要代码:
sub Products()
dim Actions
Actions=SafeInput(Request("Actions"))
Select case Actions
case "Modify"
call ModifyNews()
case "Delete"
call DeleteProducts()
case "Add"
call AddProducts()
end select
end sub
sub ModifyNews()
dim sql,ProName,ProType,NewsTitle2,cpgg,ID
ProType=SafeInput(unescape(Request.Form("ProType.value")))
ProName=SafeInput(unescape(Request.Form("ProName")))
NewsTitle2=SafeInput(unescape(Request.Form("NewsTitle2")))
cpgg=SafeInput(unescape(Request.Form("cpgg")))
ID=SafeInput(Request.Form("ID"))
If IsNumeric(ID) and not IsEmpty(ID) then
sql="update Product Set ProType='"&ProType&"',NewsTitle2='"&NewsTitle2
sql=sql&"',cpgg='"&cpgg
sql=sql&"' where ID="&ID
on error resume next
conn.execute(sql)
Response.Write(escape("修改成功!"))
else
Response.Write(escape("你提交的数据中含有非法字符!"))
end if
end sub
sub AddProducts()
dim sql,ProName,Address,ProDate,NewsFile
ProName=SafeInput(unescape(Request.Form("ProName")))
NewsFile=unescape(Request.Form("NewsFile"))
'NewsFile="a"
'ProDate=time()
sql="insert into Product (ProName,ProAddress) values "
sql=sql&"('"&ProName&"','"&NewsFile&"')"
conn.execute(sql)
Response.Write(escape("添加成功!"))
end sub
sub DeleteProducts()
dim sql,ID
ID=SafeInput(Request.Form("ID"))
If IsNumeric(ID) and not IsEmpty(ID) then
sql="delete from Product where ID="&ID
conn.execute(sql)
Response.Write(escape("删除成功!"))
else
Response.Write(escape("你提交的数据中含有非法字符!"))
end if
end sub
%>