⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.xml.asp

📁 个人相册程序-------------供大家分享
💻 ASP
字号:
<!--#include file="login.asp" -->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="style.css" rel="stylesheet" type="text/css">
<script  language="javascript">
function DrawImage(ImgD){
var width_s=139;
var height_s=104;
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>=width_s/height_s){
if(image.width>width_s){
ImgD.width=width_s;
ImgD.height=(image.height*width_s)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
else{
if(image.height>height_s){
ImgD.height=height_s;
ImgD.width=(image.width*height_s)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
/*else{
ImgD.src="";
ImgD.alt=""
}*/
}
//SELECT表单选取
function CheckSel(Voption,Value)
{
	var obj = document.getElementById(Voption);
	for (i=0;i<obj.length;i++){
		if (obj.options[i].value==Value){
		obj.options[i].selected=true;
		break;
		}
	}
	
}

 function upload_big(big_obj,small_obj,path,f)
  {
   if(f==1){
   big_obj.focus();
   }else{
   small_obj.focus();
   }
  var arr = showModalDialog("upfile.asp?f="+f+"&path="+path, "", "dialogWidth:245px; dialogHeight:80px; status:0;help:0");
  if (arr != null){
  var ss;
  ss=arr.split("*")
  if(f==1){
  big_obj.value=ss[0];
  small_obj.value=ss[1];
  }else{
  small_obj.value=ss[0];
  }
 }
}
</script>
 <%
 mode=request("mode")
 path=request("path")
 item=request("item")
 pitem=request("pitem")
 name=request("name")
 small=request("small")
 big=request("big")
 description=request("description")
 mask_n=request("mask_n")
 url="&path="&path&""
 strSourceFile = Server.MapPath("../"&path&"index.xml")
 Set objXML = Server.CreateObject("Microsoft.XMLDOM")
 'Set objXML = Server.CreateObject("Microsoft.FreeThreadedXMLDOM")
 objXML.load(strSourceFile)
 If objXML.parseError.ErrorCode <> 0 Then 
      objXML.loadXML "<?xml version=""1.0"" encoding=""gb2312"" ?>"
 End If
select case mode
case "add"
add
case "del"
del
case "edit"
edit
end select

function img_del(url)
  Set fso = CreateObject("Scripting.FileSystemObject")
  If (fso.FileExists(server.MapPath(url))) Then
	 fso.DeleteFile(server.MapPath(url))
    msg = " 存在"
  end if
end function



sub edit
    if name="" then
	response.Write("<script>alert('请填写标题!');history.back();</script>")
	response.End()
	end if
    if big="" then
	response.Write("<script>alert('请填写图片地址!');history.back();</script>")
	response.End()
	end if
	 if small="" then
	response.Write("<script>alert('请填写缩图地址!');history.back();</script>")
	response.End()
	end if
 set element=objXML.SelectSingleNode(item)
    element.setAttribute "name", name
    element.setAttribute "big", trim(big)
    element.setAttribute "small", trim(small)
	element.setAttribute "description", description
	element.setAttribute "mask_n", mask_n
 objXML.save(strSourceFile)
end sub

sub add
    if name="" then
	response.Write("<script>alert('请填写标题!');history.back();</script>")
	response.End()
	end if
    if big="" then
	response.Write("<script>alert('请填写图片地址!');history.back();</script>")
	response.End()
	end if
	 if small="" then
	response.Write("<script>alert('请填写缩图地址!');history.back();</script>")
	response.End()
	end if
    Set objRootsite = objXML.selectSingleNode(pitem)
    set element=objRootsite.appendChild(objXML.createElement("image"))
    element.setAttribute "name", name
    element.setAttribute "big", trim(big)
    element.setAttribute "small", trim(small)
	element.setAttribute "description", description
	element.setAttribute "mask_n", mask_n
    objXML.save(strSourceFile)
end sub

sub del
   set objnode=objXML.SelectSingleNode(item) '要删除的节点
    img_del("../"&path&objnode.getAttributeNode("small").nodevalue)'删除小图片
   img_del("../"&path&objnode.getAttributeNode("big").nodevalue)'删除大图片
   set objparentnode=objXML.SelectSingleNode(pitem) '要删除的节点的父节点
   objparentnode.removeChild objnode
   objXML.save(strSourceFile)
end sub
if mode="xiugai" then
set objnode=objXML.SelectSingleNode(item)
 %>
 <table width="374"  border="1" align="center" cellpadding="1" cellspacing="1">
   <form name="form1" method="post" action="index.xml.asp">
     <input  type="hidden" value="<%=path%>" name="path">
	 <input  type="hidden" value="<%=item%>" name="item">
     <input  type="hidden" value="edit" name="mode">
	 <input  type="hidden" value="<%=pitem%>" name="pitem">
     <tr>
       <td>标题</td>
       <td><input name="name" type="text" id="name" value="<%=objnode.getAttributeNode("name").nodevalue%>" size="15">
           <font color="#FF0000">*</font></td>
     </tr>
     <tr>
       <td width="61">大图</td>
       <td width="300"><table  border="0" cellspacing="0" cellpadding="0">
         <tr>
           <td><input name="big" type="text" id="big" value="<%=objnode.getAttributeNode("big").nodevalue%> " size="25">
               <font color="#FF0000">*</font></td>
           <td><input type="button" name="Submit" value="上传大图" onClick="upload_big(this.form.big,this.form.small,'<%=path%>',1);"></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td height="19">缩图</td>
       <td><table  border="0" cellspacing="0" cellpadding="0">
             <tr>
               <td><input name="small" type="text" id="small" value="<%=objnode.getAttributeNode("small").nodevalue%>" size="25">
                   <font color="#FF0000">*</font></td>
               <td><input type="button" name="Submit" value="上传缩图" onClick="upload_big(this.form.big,this.form.small,'<%=path%>',0);"></td>
             </tr>
           </table></td>
     </tr>
     <tr>
       <td height="21" >遮罩效果</td>
       <td><select name="mask_n" id="mask_n">
           <option value="" selected>关闭</option>
           <option value="1">1</option>
           <option value="2">2</option>
           <option value="3">3</option>
           <option value="4">4</option>
           <option value="5">5</option>
           <option value="6">6</option>
         </select>
           <script>CheckSel('mask_n','<%=objnode.getAttributeNode("mask_n").nodevalue%>')</script></td>
     </tr>
     <tr>
       <td height="21">描述</td>
       <td><textarea name="description" cols="30" rows="5" id="description"><%=objnode.getAttributeNode("description").nodevalue%></textarea></td>
     </tr>
     <tr align="center">
       <td colspan="2"><input type="submit" name="Submit" value="修改">       </td>
     </tr>
   </form>
 </table>
 <%else%>
 
 <table width="378"  border="1" align="center" cellpadding="1" cellspacing="1">
   <form name="form1" method="post" action="index.xml.asp">
     <input  type="hidden" value="<%=path%>" name="path">
     <input  type="hidden" value="add" name="mode">
     <input  type="hidden" value="<%="//"&objXML.documentElement.nodename&"[0]"%>" name="pitem">
     <tr>
       <td>标题</td>
       <td><input name="name" type="text" id="name" size="15">
           <font color="#FF0000">*</font></td>
     </tr>
     <tr>
       <td width="61">大图</td>
       <td width="304"><table  border="0" cellspacing="0" cellpadding="0">
         <tr>
           <td><input name="big" type="text" id="big" size="25">
             <font color="#FF0000">*</font></td>
           <td><input type="button" name="Submit" value="上传大图" onClick="upload_big(this.form.big,this.form.small,'<%=path%>',1);"></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td height="19">缩图</td>
       <td><table  border="0" cellspacing="0" cellpadding="0">
         <tr>
           <td><input name="small" type="text" id="small" size="25">
               <font color="#FF0000">*</font></td>
           <td><input type="button" name="Submit" value="上传缩图" onClick="upload_big(this.form.big,this.form.small,'<%=path%>',0);"></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td height="21" >遮罩效果</td>
       <td><select name="mask_n" id="mask_n">
         <option value="" selected>关闭</option>
         <option value="1">1</option>
         <option value="2">2</option>
		 <option value="3">3</option>
		 <option value="4">4</option>
		 <option value="5">5</option>
		 <option value="6">6</option>
       </select>       </td>
     </tr>
     <tr>
       <td height="21" >描述</td>
       <td><textarea name="description" cols="30" rows="5" id="description"></textarea></td>
     </tr>
     <tr align="center">
       <td colspan="2"><input type="submit" name="Submit" value="添加">
       </td>
     </tr>
   </form>
 </table>
 <%end if%>
 <br>
 <hr>

   
 
<%
 n=15
 Set objRootsite = objXML.documentElement
 page=Request("page")
  if page=0 then
     page=1
  end if
  RecordCount = objRootsite.ChildNodes.length 
  pageCount=RecordCount/n
  pageCount=int(pageCount)
  if (RecordCount mod n)>0 then
     PageCount=PageCount +1
  end if 
  start_i=(page-1)*n
  end_i=start_i + n -1
  if end_i>RecordCount - 1 then
  end_i=RecordCount-1
  end if
 'Set objRootsite = objXML.selectSingleNode("menu")'
 '----翻页----
response.write("<table width=""100%""  border=""0"" cellspacing=""0"" cellpadding=""0"">" & vbcrlf)
response.write("   <tr>" & vbcrlf)
response.write("     <td align=""right""> "&RecordCount&"个&nbsp; <font  color=""#FF0000"">"&page&"</font>/"&pageCount&"页 &nbsp;"&n&"个/页 转到:" & vbcrlf)
response.write("   <SELECT name=""select"" onchange=window.open(this.options[selectedIndex].value,'_self') >" & vbcrlf)
y=1
do while y<pagecount+1
response.write("     <OPTION value=index.xml.asp?page="&y&url&"")
if cstr(page)=cstr(y) then
response.Write(" selected")
end if
response.Write(">第"&y&"页</OPTION>" & vbcrlf)
y=y+1
loop
response.write("   </SELECT> " & vbcrlf)
response.write("&nbsp;</td>" & vbcrlf)
response.write("   </tr>" & vbcrlf)
response.write("<tr><td height=5><td></tr> </table>")

show_images objRootsite,start_i,end_i
function show_images(objRootsite,start_i,end_i)
  response.write("<table   border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">" & vbcrlf)
  response.write("  <tr>" & vbcrlf)
  for i =start_i to end_i
  response.write("    <td width=""140"" ><table width=""100%""  border=""1"" align=""center"" cellpadding=""1"" cellspacing=""1"" >" & vbcrlf)
  response.write("      <tr>" & vbcrlf)
  response.write("        <td  align=""center"" valign=""middle"" width=""139"" height=""108""><a href="""&server.URLEncode("../"&path&objRootsite.ChildNodes(i).getAttributeNode("big").nodevalue&"")&""" target=""_blank""><img src="""&server.URLEncode("../"&path&objRootsite.ChildNodes(i).getAttributeNode("small").nodevalue&"")&"""   width=139 height=104 border=0 onload=""javascript:DrawImage(this);""></a></td>" & vbcrlf)
  response.write("      </tr>" & vbcrlf)
  response.write("      <tr bgcolor=""#c9c9c9"">" & vbcrlf)
  response.write("        <td align=""center"">"&objRootsite.ChildNodes(i).getAttributeNode("name").nodevalue&"</td>" & vbcrlf)
  response.write("      </tr>" & vbcrlf)
  response.write("      <tr>" & vbcrlf)
  response.write("        <td align=""center""><table width=""100%""  border=""0"" cellspacing=""0"" cellpadding=""0"">" & vbcrlf)
  response.write("          <tr align=""center"" bgcolor=""#e9e9e9"">" & vbcrlf)
  response.write("            <td width=""48%"" ><a href=""index.xml.asp?mode=xiugai&pitem=//"&objRootsite.nodename&"[0]&item=//"&objRootsite.nodename&"[0]/"&objRootsite.ChildNodes(i).nodename&"["&i&"]"&url&""" >修改</a></td>" & vbcrlf)
  response.write("            <td width=""52%""><a href=""index.xml.asp?mode=del&pitem=//"&objRootsite.nodename&"[0]&item=//"&objRootsite.nodename&"[0]/"&objRootsite.ChildNodes(i).nodename&"["&i&"]"&url&""" onClick=""javascript:if(confirm('确定删除吗?')){return true;}else{return false;}"">删除</td>" & vbcrlf)
  response.write("          </tr>" & vbcrlf)
  response.write("        </table></td>" & vbcrlf)
  response.write("      </tr>" & vbcrlf)
  response.write("    </table></td>" & vbcrlf)
  if (i+1) mod 5 = 0 then
	response.Write("  </tr><tr>" & vbcrlf)
	end if 
  next
  response.write("  </tr>" & vbcrlf)
  response.write("</table>" & vbcrlf)
end function


%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -