發表于:2010-12-16 00:00:00來(lái)源:人(rén)氣:2844
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Action=Request.QueryString("Action")
Dim aID,aryTemp,Total,i,j,csID
csID=25
j=1%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>實例删除Split分(fēn)隔的内容其中的某一部份</title>
<style type="text/css">
* {margin:0px; padding:0px; line-height:180%;}
a {color:#666666; text-decoration:none;}
</style>
</head>
<body>
<%
Function RtnReplaceInt(iCheck,iDefault)
If Trim(iCheck)="" Then
RtnReplaceInt = iDefault
Exit Function
End If
If IsNumeric(iCheck)=false Then
RtnReplaceInt = iDefault
Exit Function
End If
RtnReplaceInt = iCheck
End Function
Select Case Action
Case "Add"
Call AddPic
Case "Delete"
Call DeletePic
Case else
Manage
End Select
sub Manage
end sub
sub DeletePic
uPic=Request("DelPic")
Str=Request("nPic")
Str=Replace(Str,uPic&",","")
Str=Replace(Str,","&uPic,"")
'Response.Write(""&Str&"")
'Response.End()
PicID=RtnReplaceInt(Request("PicID"),0)
sql="update 表名 set 字段='"&Str&"' where 數據庫ID in ("&Request("PicID")&")"
conn.execute(sql)
Response.write"<script>alert('操作(zuò)成功!');location.href='?Action=Manage'</script>"
Response.end
end sub%>
<p> </p>
<table width="80%" border="0" align="center" cellspacing="0">
<tr>
<%aID="20101111212349940.jpg,20101111212351417.jpg,20101111212357390.jpg,20101111212402671.jpg,20101111212404837.jpg"
aryTemp = Split(aID,",")
Total=UBound(aryTemp)
for i=0 to Total
%>
<td align="center"><a href="<%= aryTemp(i) %>"><img src="<%= aryTemp(i) %>" width="100" height="100" style="border:1px #cccccc solid;"></a><BR><a href="?Action=Delete&DelPic=<%= aryTemp(i) %>&PicId=<%= csID %>&nPic=<%= aID %>">删除</a></td>
<%
j=j+1
next
%>
</tr>
</table>
</body>
</html>