教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 法律文档 >

[毕业论文]基于HTML5 CSS3的相册设计与实现 - 图文(6)

来源:网络收集 时间:2025-09-17
导读: //获取路径 string dictionName = Server.MapPath(\ if (!Directory.Exists(dictionName)) { //根据获取到的路径创建目录 Directory.CreateDirectory(dictionName); initFenleis(); } } 分类列表使用了一个asp.net

//获取路径

string dictionName = Server.MapPath(\ if (!Directory.Exists(dictionName)) {

//根据获取到的路径创建目录

Directory.CreateDirectory(dictionName); initFenleis(); } }

分类列表使用了一个asp.net 的Repeater控件

前台控件代码:

<%#Container.ItemIndex + 1 %>

<%#GetDataItem()%>

OnClientClick=\删除分类后将连分类内的图片一起删除确认要删除吗?')\删|?除y

- 22 -

后台数据绑定代码: public void initFenleis() {

string[] dict = getFenlei(); for (int i = 0; i < dict.Length;i++ ) {

dict[i] = dict[i].Substring(dict[i].LastIndexOf(\dict[i].Length - dict[i].LastIndexOf(\ }

Repeater1.DataSource = dict; Repeater1.DataBind();

}

//获取分类列表 public string[] getFenlei() {

string filepath = Server.MapPath(\

string[] filenames = Directory.GetDirectories(filepath); return filenames; }

点删除时调用的代码:

protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) {

if (e.CommandName.Equals(\ {

string dic = e.CommandArgument.ToString(); DeleteFolderAll(Server.MapPath(\ }

initFenleis(); }

//初始化分类列表

- 23 -

///

/// 删除文件夹及其内容 ///

///

public static void DeleteFolderAll(string dir) {

foreach (string d in Directory.GetFileSystemEntries(dir)) {

if (File.Exists(d)) {

FileInfo fi = new FileInfo(d);

if (fi.Attributes.ToString().IndexOf(\ fi.Attributes = FileAttributes.Normal; File.Delete(d);//直接删除其中的文件 } else {

DeleteFolder(d);////递归删除子文件夹 Directory.Delete(d); } }

Directory.Delete(dir); }

///

/// 清空指定的文件夹但不删文件夹 ///

///

public static void DeleteFolder(string dir) {

foreach (string d in Directory.GetFileSystemEntries(dir)) {

- 24 -

if (File.Exists(d)) {

FileInfo fi = new FileInfo(d);

if (fi.Attributes.ToString().IndexOf(\ fi.Attributes = FileAttributes.Normal; File.Delete(d);//直接删除其中的文件 } else {

DirectoryInfo d1 = new DirectoryInfo(d); if (d1.GetFiles().Length != 0) {

DeleteFolder(d1.FullName);////递归删除子文件夹 }

Directory.Delete(d); } }

} CSS:

.divTab{position:relative; top:2px; margin-left:10px;}

.divContent {

-webkit-box-shadow:0px 0px 10px #ddd; -moz-box-shadow:0px 0px 10px #ddd; box-shadow:0px 0px 10px #ddd; }

.divTab a{ text-shadow:1px 1px 5px #999; display:block; float:left; margin-right:5px; border:solid 2px #ddd; padding:0px 10px;

-webkit-border-top-left-radius:5px;

- 25 -

-webkit-border-top-right-radius:5px;

background-color:#eff; color:gray; text-decoration:none; cursor:pointer; }

.divTab a:hover{background-color:#fef;}

.divTab .aCur{ border-bottom:solid 2px white; background-color:white; color:blue; cursor:default; }

.divTab .aCur:hover { background-color:white; } table {

*border-collapse: collapse; /* IE7 and lower */ border-spacing: 0; width: 100%; }

.bordered {

border: solid #ccc 1px; -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px;

-webkit-box-shadow: 0 1px 1px #ccc; -moz-box-shadow: 0 1px 1px #ccc; box-shadow: 0 1px 1px #ccc; }

.bordered tr:hover { background: #fbf8e9;

-o-transition: all 0.1s ease-in-out;

- 26 -

…… 此处隐藏:765字,全部文档内容请下载后查看。喜欢就下载吧 ……
[毕业论文]基于HTML5 CSS3的相册设计与实现 - 图文(6).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/434393.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)