73 lines
1.7 KiB
JavaScript
73 lines
1.7 KiB
JavaScript
//单击
|
|
function item_click(obj){
|
|
var file_id=$(obj).attr("file_id");
|
|
var has_on=$(obj).hasClass("ui-btn-active");
|
|
if(has_on){
|
|
$(obj).removeClass("ui-btn-active");
|
|
}else{
|
|
$(obj).addClass("ui-btn-active");
|
|
}
|
|
}
|
|
//双击
|
|
function item_dbclick(obj){
|
|
$(".file_item ").removeClass("ui-btn-active");
|
|
$(obj).addClass("ui-btn-active");
|
|
file_choice();
|
|
}
|
|
|
|
//最终选择的文件
|
|
function file_choice(){
|
|
var choice_item=$(".file_list .ui-btn-active");
|
|
var choice_num=choice_item.length;
|
|
var obj_val=new Array(1);
|
|
|
|
if(!file_checkbox&&choice_num>1){
|
|
alert("您只能选择一个文件");
|
|
return;
|
|
}
|
|
if(choice_num<1){
|
|
alert("您至少要选择一个文件");
|
|
return;
|
|
}
|
|
//
|
|
$.each(choice_item,function(){
|
|
var this_obj_val={};
|
|
this_obj_val.file_path=$(this).attr("file_path");
|
|
this_obj_val.file_name=$(this).attr("file_name");
|
|
this_obj_val.small_pic=$(this).attr("small_pic");
|
|
obj_val.push(this_obj_val);
|
|
})
|
|
window.opener.file.file_data=obj_val;//给八父页面变量赋值
|
|
window.opener.focus();
|
|
self.close();
|
|
|
|
//
|
|
|
|
|
|
}
|
|
//删除文件
|
|
function file_delete(){
|
|
var choice_item=$(".file_list .ui-btn-active");
|
|
var choice_num=choice_item.length;
|
|
if(confirm("删除的文件如果被其它调用将无法显示,您确定要删除吗?")==false){
|
|
return false;
|
|
}
|
|
if(choice_num<1){
|
|
alert("请选择要删除的文件");
|
|
return;
|
|
}else{
|
|
var file_ids="";
|
|
$.each(choice_item,function(){
|
|
if(file_ids){
|
|
file_ids=file_ids+","+$(this).attr("file_id");
|
|
}else{
|
|
file_ids=$(this).attr("file_id");
|
|
}
|
|
})
|
|
$.get(deleteurl,{"ids":file_ids},function(result){
|
|
$(".file_list").html("");
|
|
page=0;
|
|
getlist();
|
|
})
|
|
}
|
|
} |