www.gusucode.com > 因特达Access数据库在线管理系统 > 因特达Access数据库在线管理系统\code\access\js\file_list_right.js

    function body_click(path,selfPath)
{
	var obj=event.srcElement;
	if(obj.tagName==('A'))
	{
		switch (obj.innerText)
		{
			case "编辑":edit(obj,path);return;
			case "更名":rename(obj,path,'refile');return;
			case "删除":del(obj,path,'delfile');return;
			case "下载":downfile(obj,path);return;
		}
		if (obj.href.indexOf('#f')>0)
		{
			window.open(selfPath+'/'+path+obj.innerText,'','')
		}
	}
}

function edit(obj,path)
{
	var fileName=obj.parentElement.parentElement.cells[1].innerText;
	//alert(document.location.href)
	window.open('file_edit.asp?path='+path+""+fileName,'','scrollbars=yes,resizable=yes')
}

function rename(obj,path,act)
{
	fileName=obj.parentElement.parentElement.cells[1].innerText;
	fileName=url_encode(fileName)
	var newname=window.prompt("请输入文件(夹)"+fileName+"的新名称:","");
	if(newname!=null)
	{
		newname=url_encode(newname);
		blank.location="file_rename.asp?act="+act+"&path="+path+"&fname="+fileName+"&newname="+newname;
	}
}

function url_encode(s_str)
{
	s_str=s_str.replace("%","%25");
	s_str=s_str.replace("&","%26");
	s_str=s_str.replace("+","%2B");
	s_str=s_str.replace("#","%23");
	s_str=s_str.replace("=","%3D");
	s_str=s_str.replace("?","%3F");
	s_str=s_str.replace(" ","+");
	return(s_str);
}

function downfile(obj,path)
{
	fileName=obj.parentElement.parentElement.cells[1].innerText;
	fileName=url_encode(fileName)
	window.open("file_down.asp?path="+path+fileName,'','');
}

function del(obj,path,act)
{
	if (window.confirm("你真的要删除该文件吗?")==true)
	{
		var fileName=obj.parentElement.parentElement.cells[1].innerText;
		fileName=url_encode(fileName)
		blank.location='file_del.asp?path='+path+''+fileName+'&act='+act
	}
}