function.js
资源名称:BBWPS.rar [点击查看]
上传用户:yttaitong
上传日期:2009-05-10
资源大小:128k
文件大小:16k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
PHP
- /*
- --------------------------
- Copyright by T.muqiao(39号天堂桥)
- 本程序仅供学习讨论使用,在未通知作者作为任何商业用途
- 视为中华人民共和国不道德公民
- 联系方式:442536278@qq.com
- -------------------------*/
- //兼容microsoft的IE和mozilla的FireFox(2月5日搞定)
- //*****************右键菜单******************/
- //
- var y = null;
- var x = null;
- var z = null;
- var w = null;
- var type = 0;
- var path = ".";
- var ID = null;
- var menu = null;
- var ns6=(document.getElementById&&!document.all);
- var ie=(document.all);
- if (ns6){
- window.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
- document.releaseEvents(Event.MOUSEMOVE);
- }
- if (ie||document.getElementById){
- document.onmousedown = down;
- }
- if(ie||ns6){
- document.oncontextmenu = oncontext;
- }
- if(ie){
- document.onmouseup = microie;
- }
- if(ns6){
- document.onmouseup = mozilla;
- }
- function oncontext(){
- return false;
- }
- function setvars(n,value,Idvalue){
- type = n;
- path = value;
- ID = Idvalue;
- }
- function start(obj){
- if (ie||ns6){
- z = document.getElementById(obj).style;
- }
- ID = null;
- }
- function down(e){
- for(i=1;i<Elements;i++){
- if(i==ID){
- document.getElementById("element_"+i).className = 'selected';
- }else{
- document.getElementById("element_"+i).className = 'default';
- }
- }
- document.onmousemove = move;
- if (ie){
- y=window.event.offsetY;
- x=window.event.offsetX;
- }
- if (ns6){
- x=e.clientX - parseInt(z.left);
- y=e.clientY - parseInt(z.top);
- }
- return false;
- }
- function move(e){
- if(z){
- if (ns6){
- z.top = parseInt(e.clientY)-y;
- z.left = parseInt(e.clientX)-x;
- }
- if (ie){
- z.posLeft = window.event.clientX-x;
- z.posTop = window.event.clientY-y;
- }
- }
- return false;
- }
- function microie(e){
- if(z){
- document.onmousemove=null;
- }
- if(ie){
- menu = document.getElementById("rightmenu");
- if(event.button==2){
- makemenu();
- var rightedge = document.body.clientWidth-event.clientX;
- var bottomedge = document.body.clientHeight-event.clientY;
- if (rightedge < menu.offsetWidth){
- menu.style.left = document.body.scrollLeft + event.clientX - menu.offsetWidth;
- }else{
- menu.style.left = document.body.scrollLeft + event.clientX;
- }
- if (bottomedge < menu.offsetHeight){
- menu.style.top = document.body.scrollTop + event.clientY - menu.offsetHeight;
- }else{
- menu.style.top = document.body.scrollTop + event.clientY;
- }
- menu.style.visibility = "visible";
- return false;
- }
- if(event.button==1){
- hidemenu();
- }
- }
- }
- function mozilla(e){
- if(z){
- document.onmousemove=null;
- }
- if(ns6){
- menu = document.getElementById("rightmenu");
- if(e.which==3){
- makemenu();
- var rightedge = document.body.clientWidth-parseInt(e.clientX);
- var bottomedge = document.body.clientHeight-parseInt(e.clientY);
- if (rightedge < menu.offsetWidth){
- menu.style.left = document.body.scrollLeft + parseInt(e.clientX) - menu.offsetWidth;
- }else{
- menu.style.left = document.body.scrollLeft + parseInt(e.clientX);
- }
- if (bottomedge < menu.offsetHeight){
- menu.style.top = document.body.scrollTop + parseInt(e.clientY) - menu.offsetHeight;
- }else{
- menu.style.top = document.body.scrollTop + parseInt(e.clientY);
- }
- menu.style.visibility = "visible";
- }
- if(e.which==1){
- hidemenu();
- }
- }
- return false;
- }
- function hidemenu() {
- menu.style.visibility = "hidden";
- }
- //
- //******************浮动窗口*******************/
- //
- function Tclose(obj){
- document.getElementById(obj).innerHTML = '';
- document.getElementById(obj).style.visibility = 'hidden';
- z=null;
- }
- function newwindow(title,content){
- var str = '<table style="border: 1px solid #000000;width:100%;height:100%;" cellpadding="0" cellspacing="0">'
- +'<tr class="divheader">'
- +'<td style="padding-left:5px;width:400px;color:#FFFFFF" onMouseUp="z=null;" onMouseMove="if(window.event.button==1){start('float');}">'+title+'</td>'
- +'<td width="41px" onclick="Tclose('float')" title="'+T_lang[0]+'" class="slow" onMouseMove="if(window.event.button==0){this.className='light';}" onMouseOut="this.className='slow'"></td>'
- +'</tr>'
- +'<tr ><td colspan="2" style="background:#666666;"><center>'+content+'</center></td></tr></table>';
- document.getElementById("float").innerHTML = str;
- document.getElementById("float").style.visibility = 'visible';
- }
- function editwindow(filename,content){
- var str = '<table style="border: 1px solid #7AC4EA;width:100%;height:100%;background:#FFFFFF;" cellpadding="1" cellspacing="0">'
- +'<tr class="memberheader">'
- +'<td style="padding-left:5px;width:700px;color:#154BA0;" >'+filename+'</td>'
- +'<td width="35px" onclick="Tclose('edit')" title="'+T_lang[0]+'" class="eslow" onMouseOver="this.className='elight'" onMouseOut="this.className='eslow'"></td>'
- +'</tr>'
- +'<tr ><td colspan="2" style="background:#FFFFFF;height:480px;">'+content+'</td></tr></table>';
- document.getElementById("edit").innerHTML = str;
- document.getElementById("edit").style.visibility = 'visible';
- }
- //
- //*****************文件夹及文件任务******************/
- //
- function makemenu(){
- if(type==1){
- var str =
- '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','rewrite')">'+T_lang[1]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','copy')">'+T_lang[2]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','scissor')">'+T_lang[3]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','crush')">'+T_lang[4]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','rename')">'+T_lang[5]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','attribute')">'+T_lang[6]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','download')">'+T_lang[7]+'</div>'
- ;
- }else if(type==4){
- var str =
- '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','rewrite')">'+T_lang[1]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','copy')">'+T_lang[2]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','scissor')">'+T_lang[3]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','delete')">'+T_lang[8]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','return')">'+T_lang[9]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','rename')">'+T_lang[5]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','attribute')">'+T_lang[6]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','download')">'+T_lang[7]+'</div>'
- ;
- }else if(type==2){
- var str =
- '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="window.location=''+T_main+'?path='+path+''">'+T_lang[10]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','copy')">'+T_lang[2]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','scissor')">'+T_lang[3]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','crush')">'+T_lang[4]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','rename')">'+T_lang[5]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','attribute')">'+T_lang[6]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','download')">'+T_lang[11]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','shortcut')">'+"创建快捷方式"+'</div>'
- ;
- }else if(type==5){
- var str =
- '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="window.location=''+T_main+'?path='+path+''">'+T_lang[10]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','copy')">'+T_lang[2]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','scissor')">'+T_lang[3]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','delete')">'+T_lang[8]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','return')">'+T_lang[9]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','rename')">'+T_lang[5]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','attribute')">'+T_lang[6]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','download')">'+T_lang[11]+'</div>'
- ;
- }else if(type==3){
- var str =
- '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="window.location=''+T_main+'?path='+path+''">'+T_lang[10]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','attribute')">'+T_lang[6]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="T_clear(''+path+'')">'+T_lang[12]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','download')">'+T_lang[11]+'</div>'
- ;
- }else if(type==0){
- var str =
- '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="window.location=''+T_main+'?path='+path+''">'+T_lang[13]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="PreDir(''+path+'')">'+T_lang[14]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','stepstick')">'+T_lang[15]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="T_newstepone(''+path+'','newfolder')">'+T_lang[16]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="T_newstepone(''+path+'','newfile')">'+T_lang[17]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="T_setnum(''+path+'')">'+T_lang[18]+'</div>'
- + '<div class="menuinit" onMouseover="this.className='menuover'" onMouseOut="this.className='menuinit'" onclick="Tasks(''+path+'','attribute')">'+T_lang[6]+'</div>'
- ;
- }
- menu.innerHTML = str;
- }
- function Tasks(xpath,taskname){
- if(taskname=="stick"){
- document.passform.type.value = "cover";
- }
- document.passform.path.value = xpath;
- document.passform.action.value = taskname;
- document.passform.submit();
- if(taskname=="attribute"||taskname=="download"||taskname=="stepstick"||taskname=="stick"){
- holdwin();
- }
- }
- function holdwin(){
- document.getElementById("float").innerHTML="<font color=red size=5>正在处理,请稍后……</font>";
- document.getElementById("float").style.visibility = 'visible';
- }
- function PreDir(xpath){
- var route = xpath.split("%2F");
- var newdir = route[0];
- for(i=1;i<route.length-1;i++){
- newdir += "%2F"+route[i];
- }
- window.location=(T_main+'?path='+newdir);
- }
- function T_setnum(xpath){//上传文件到xpath
- var title = T_lang[19];
- var content = '<font color=#FFFFFF>'+T_lang[20]+':</font><form name=upnum><input name="num" value=1 size="40" /><br />'
- +'<input type="button" onclick="T_setfiles(''+xpath+'',document.upnum.num.value);" value="'+T_lang[21]+'" /> '
- +'<input type="button" onclick="Tclose('float')" value="'+T_lang[22]+'"></form>';
- newwindow(title,content);
- }
- function T_setfiles(xpath,num){
- var title = T_lang[23];
- var content = '<form action="'+T_task+'" method="post" enctype="multipart/form-data" target="passframe">'
- +'<br><input type="hidden" name="path" value='+xpath+'>';
- //+'<input type="hidden" name="MAX_FILE_SIZE" value="$T_max_size">';
- if(num>20){
- num=20;
- }
- for(i=1;i<=num;i++){
- var number='';
- if(i<10){
- number='0'+i;
- }else{
- number=i;
- }
- content +='<font color=#FFFFFF>'+T_lang[24]+number+':</font><input type="file" name="file[]"><font color="red">*</font><br />';
- }
- content +='<input type="submit" value="'+T_lang[25]+'"> '
- +'<input type="hidden" name="action" value="upload">'
- +'<input type=button onclick="Tclose('float')" value="'+T_lang[22]+'" /><br><br></form>';
- newwindow(title,content);
- }
- function T_clear(xpath){
- var title = ''+T_lang[26];
- var content = '<font color=#FFFFFF>'+T_lang[27]+'</font><br />'
- +'<input type="button" onclick="Tasks(''+xpath+'','recycled');Tclose('float')" value="'+T_lang[28]+'"> ';
- +'<input type="button" onclick="Tclose('float')" value="'+T_lang[22]+'"></form>';
- newwindow(title,content);
- }
- function T_newstepone(xpath,xtype){
- if(xtype=="newfolder"){
- var title = T_lang[29];
- var content = '<form action="'+T_task+'" method="post" target="passframe">'
- +'<input type="hidden" name="path" value="'+xpath+'">'
- +'<input type="hidden" name="action" value="'+xtype+'">'
- +'<input name="foldername" value="newfoldername" size=50/><br>'
- +'<input type="button" onclick="this.form.submit();Tclose('float')" value="'+T_lang[31]+'"> '
- +'<input type="button" onclick="Tclose('float')" value="'+T_lang[22]+'"></form>';
- }else if(xtype=="newfile"){
- var title = T_lang[30];
- var hiddenname = "filename";
- var content = '<form action="'+T_task+'" method="post" target="passframe">'
- +'<input type="hidden" name="path" value="'+xpath+'">'
- +'<input type="hidden" name="action" value="'+xtype+'">'
- +'<input name="filename" value="newfilename" size=30 />.<input name="exttype" value="txt" size=10 /><br />'
- +'<input type="button" onclick="this.form.submit();Tclose('float')" value="'+T_lang[31]+'"> '
- +'<input type="button" onclick="Tclose('float')" value="'+T_lang[22]+'"></form>';
- }
- if(xpath&&xtype){
- newwindow(title,content);
- }
- }
- //
- //*****************文件夹及文件任务结束******************/
- //