仿网易界面

<html>    
   
<head>    
   
<title>Add Files</title>    
   
<style>    
   
a.addfile {    
   
background-image:url(http://p.mail.163.com/js31style/lib/0703131650/163blue/f1.gif);    
   
background-repeat:no-repeat;    
   
background-position:-823px -17px;    
   
display:block;    
   
float:left;    
   
height:20px;    
   
margin-top:-1px;    
   
position:relative;    
   
text-decoration:none;    
   
top:0pt;    
   
width:80px;    
   
}    
   
   
   
input.addfile {    
   
/*left:-18px;*/   
   
}    
   
   
   
input.addfile {    
   
cursor:pointer !important;    
   
height:18px;    
   
left:-13px;    
   
filter:alpha(opacity=0);    
   
position:absolute;    
   
top:5px;    
   
width:1px;    
   
z-index: -1;    
   
}    
   
</style>    
   
   
   
<script type="text/javascript">    
   
   
   
function MultiSelector(list_target, max)    
   
{    
   
    // Where to write the list    
   
    this.list_target = list_target;    
   
    // How many elements?    
   
    this.count = 0;    
   
    // How many elements?    
   
    this.id = 0;    
   
    // Is there a maximum?    
   
    if (max)    
   
     {    
   
        this.max = max;    
   
     }    
   
    else    
   
     {    
   
        this.max = -1;    
   
     };    
   
   
   
    /** 

      * Add a new file input element 

      */   
   
    this.addElement = function(element)    
   
     {    
   
        // Make sure it's a file input element    
   
        if (element.tagName == 'INPUT' && element.type == 'file')    
   
         {    
   
            // Element name -- what number am I?    
   
             element.name = 'file_' + this.id++;    
   
   
   
            // Add reference to this object    
   
             element.multi_selector = this;    
   
   
   
            // What to do when a file is selected    
   
             element.onchange = function()    
   
             {    
   
                // New file input    
   
                var new_element = document.createElement('input');    
   
                 new_element.type = 'file';    
   
                 new_element.size = 1;    
   
                 new_element.className = "addfile";    
   
   
   
                // Add new element    
   
                this.parentNode.insertBefore(new_element, this);    
   
   
   
                // Apply 'update' to element    
   
                this.multi_selector.addElement(new_element);    
   
   
   
                // Update list    
   
                this.multi_selector.addListRow(this);    
   
   
   
                // Hide this: we can't use display:none because Safari doesn't like it    
   
                this.style.position = 'absolute';    
   
                this.style.left = '-1000px';    
   
             };    
   
   
   
   
   
            // If we've reached maximum number, disable input element    
   
            if (this.max != -1 && this.count >= this.max)    
   
             {    
   
                 element.disabled = true;    
   
             };    
   
   
   
            // File element counter    
   
            this.count++;    
   
            // Most recent element    
   
            this.current_element = element;    
   
         }    
   
        else    
   
         {    
   
            // This can only be applied to file input elements!    
   
             alert('Error: not a file input element');    
   
         };    
   
     };    
   
   
   
   
   
    /** 

      * Add a new row to the list of files 

      */   
   
    this.addListRow = function(element)    
   
     {    
   
        // Row div    
   
        var new_row = document.createElement('div');    
   
   
   
        // Delete button    
   
        var new_row_button = document.createElement('input');    
   
         new_row_button.type = 'button';    
   
         new_row_button.value = 'Delete';    
   
   
   
        // References    
   
         new_row.element = element;    
   
   
   
        // Delete function    
   
         new_row_button.onclick = function()    
   
         {    
   
            // Remove element from form    
   
            this.parentNode.element.parentNode.removeChild(this.parentNode.element);    
   
   
   
            // Remove this row from the list    
   
            this.parentNode.parentNode.removeChild(this.parentNode);    
   
   
   
            // Decrement counter    
   
            this.parentNode.element.multi_selector.count--;    
   
   
   
            // Re-enable input element (if it's disabled)    
   
            this.parentNode.element.multi_selector.current_element.disabled = false;    
   
   
   
            // Appease Safari    
   
            // without it Safari wants to reload the browser window    
   
            // which nixes your already queued uploads    
   
            return false;    
   
         };    
   
   
   
        // Set row value    
   
         new_row.innerHTML = element.value + " ";    
   
   
   
        // Add button    
   
         new_row.appendChild(new_row_button);    
   
   
   
        // Add it to the list    
   
        this.list_target.appendChild(new_row);    
   
     };    
   
};    
   
</script>    
   
</head>    
   
   
   
<body>    
   
   
   
<!-- This is the form -->    
   
<form enctype="multipart/form-data" action="http://127.0.0.1:8080/xxx/fileUploadAction.action" method="post">    
   
<!-- The file element -- NOTE: it has an ID -->    
   
<a href="javascript:void(1==1);" class="addfile" style="cursor: default;" hidefocus="true">    
   
<input id="my_file_element" class="addfile" type="file" name="file_1" size="1" title="点击选择附件">    
   
</a>    
   
<input type="submit" value="上 传">    
   
</form>    
   
   
   
Files:    
   
<!-- This is where the output will appear -->    
   
<div id="files_list" style="padding:5px;border:1px;border-style:solid;border-color:#0000ff;height:100px;width:600px;"></div>    
   
<script>    
   
<!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->    
   
var multi_selector = new MultiSelector(document.getElementById('files_list'), 100);    
   
<!-- Pass in the file element -->    
   
multi_selector.addElement(document.getElementById('my_file_element'));    
   
</script>    
   
   
   
</body>    
   
</html>   

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
目标检测(Object Detection)是计算机视觉领域的一个核心问题,其主要任务是找出图像中所有感兴趣的目标(物体),并确定它们的类别和位置。以下是对目标检测的详细阐述: 一、基本概念 目标检测的任务是解决“在哪里?是什么?”的问题,即定位出图像中目标的位置并识别出目标的类别。由于各类物体具有不同的外观、形状和姿态,加上成像时光照、遮挡等因素的干扰,目标检测一直是计算机视觉领域最具挑战性的任务之一。 二、核心问题 目标检测涉及以下几个核心问题: 分类问题:判断图像中的目标属于哪个类别。 定位问题:确定目标在图像中的具体位置。 大小问题:目标可能具有不同的大小。 形状问题:目标可能具有不同的形状。 三、算法分类 基于深度学习的目标检测算法主要分为两大类: Two-stage算法:先进行区域生成(Region Proposal),生成有可能包含待检物体的预选框(Region Proposal),再通过卷积神经网络进行样本分类。常见的Two-stage算法包括R-CNN、Fast R-CNN、Faster R-CNN等。 One-stage算法:不用生成区域提议,直接在网络中提取特征来预测物体分类和位置。常见的One-stage算法包括YOLO系列(YOLOv1、YOLOv2、YOLOv3、YOLOv4、YOLOv5等)、SSD和RetinaNet等。 四、算法原理 以YOLO系列为例,YOLO将目标检测视为回归问题,将输入图像一次性划分为多个区域,直接在输出层预测边界框和类别概率。YOLO采用卷积网络来提取特征,使用全连接层来得到预测值。其网络结构通常包含多个卷积层和全连接层,通过卷积层提取图像特征,通过全连接层输出预测结果。 五、应用领域 目标检测技术已经广泛应用于各个领域,为人们的生活带来了极大的便利。以下是一些主要的应用领域: 安全监控:在商场、银行
以下是一个简单的实现过程: 1. 导入必要的模块 ```python import tkinter as tk from tkinter import ttk from tkinter import messagebox from PIL import Image, ImageTk ``` 2. 创建主窗口和控制面板 ```python root = tk.Tk() root.title("网易云音乐") root.geometry("800x600") # 创建控制面板 control_panel = tk.Frame(root, bg="#f2f2f2") control_panel.place(x=0, y=0, relwidth=1, relheight=0.1) # 创建界面 main_frame = tk.Frame(root, bg="#f2f2f2") main_frame.place(x=0, y=60, relwidth=1, relheight=0.9) ``` 3. 加载图标并创建标签 ```python # 加载图标 img_logo = ImageTk.PhotoImage(Image.open("logo.png")) # 创建标签 logo_label = tk.Label(control_panel, image=img_logo) logo_label.pack(side="left", padx=10) title_label = tk.Label(control_panel, text="网易云音乐", font=("微软雅黑", 20), bg="#f2f2f2") title_label.pack(side="left", padx=10) search_entry = tk.Entry(control_panel, width=50, font=("微软雅黑", 12)) search_entry.pack(side="left", padx=10) search_button = tk.Button(control_panel, text="搜索", font=("微软雅黑", 12)) search_button.pack(side="left", padx=10) ``` 4. 创建音乐列表 ```python # 创建音乐列表 music_list = ttk.Treeview(main_frame, columns=("title", "artist", "album", "time"), show="headings") music_list.column("title", width=200) music_list.column("artist", width=150) music_list.column("album", width=100) music_list.column("time", width=50) music_list.heading("title", text="音乐标题") music_list.heading("artist", text="歌手") music_list.heading("album", text="专辑") music_list.heading("time", text="时长") music_list.pack(side="left", fill="both", expand=True) ``` 5. 创建音乐详情面板 ```python # 创建音乐详情面板 detail_panel = tk.Frame(main_frame, bg="white") detail_panel.place(x=400, y=0, relwidth=0.6, relheight=1) detail_title_label = tk.Label(detail_panel, text="音乐标题", font=("微软雅黑", 20), bg="white") detail_title_label.pack(pady=20) detail_artist_label = tk.Label(detail_panel, text="歌手:", font=("微软雅黑", 14), bg="white") detail_artist_label.pack(pady=10) detail_album_label = tk.Label(detail_panel, text="专辑:", font=("微软雅黑", 14), bg="white") detail_album_label.pack(pady=10) detail_lyric_label = tk.Label(detail_panel, text="歌词:", font=("微软雅黑", 14), bg="white") detail_lyric_label.pack(pady=10) detail_lyric_text = tk.Text(detail_panel, font=("微软雅黑", 12), bg="white", width=50, height=10) detail_lyric_text.pack(pady=10) ``` 6. 定义搜索函数 ```python # 定义搜索函数 def search(): keyword = search_entry.get() if keyword.strip() == "": messagebox.showwarning("提示", "请输入搜索关键字!") return music_list.delete(*music_list.get_children()) # 清空列表 # TODO: 根据搜索关键字获取音乐列表,并添加到音乐列表中 ``` 7. 绑定搜索按钮事件 ```python # 绑定搜索按钮事件 search_button["command"] = search ``` 完整代码如下:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值