[原創]php+ajax實現模擬Win文件管理系統
//本教程由本站原創,轉載請注明來處
作者:www.drise.cn
QQ:271728967
//
上面php文件講完了,下面來講一下,document.js文件.些文件來自互聯網.
var subMenuSrcObj=null;
function ShowMenu(obj,x,y){
try{
subMenuSrcObj=obj;
document.getElementById("subMenu").style.top=(ie_y(obj)+obj.offsetHeight+y)+"px";
document.getElementById("subMenu").style.left=(ie_x(obj)+x)+"px";
}catch(e)
{ ;
}
}
function loadsubMenu()
{
document.body.insertAdjacentHTML("afterBegin","<div id=\"subMenu\" style=\"filter:progid:DXImageTransform.Microsoft.DropShadow(color=#333333,offX=1,offY=1,positives=true);position:absolute; left:-10025px; top:47px; width:100px; height:1px;background-color: #D4D0C8;z-index:99999\">s</div>");
}
function hiddenSubMenu1()
{
document.getElementById("subMenu").style.left="-9000px";
}
function hiddenSubMenu()
{
try
{
obj=document.getElementById("subMenu");
temp=false;
e=event.srcElement;
if(e==obj)
{
temp=false;
}else
{
temp=true;
while(e=e.offsetParent)
{
if(e==obj||e==subMenuSrcObj)
{
temp=false;
}
}
}
if(event.srcElement==subMenuSrcObj)
{
temp=false;
}
if(temp&&parseInt(obj.style.left)>0)
{
hiddenSubMenu1();
}
}
catch (e)
{
}
}
function ie_y(e){
var t=e.offsetTop;
while(e=e.offsetParent){
t+=e.offsetTop;
}
return t;
}
function ie_x(e){
var l=e.offsetLeft;
while(e=e.offsetParent){
l+=e.offsetLeft;
}
return l;
}
function del(){
}
function myMenuShow(obj,btn)
{
document.getElementById("subMenu").innerHTML="<li onMouseOver=\"this.style.backgroundColor='#F5FBFF'\" onMouseOut=\"this.style.backgroundColor=''\" onclick=\"alert('"+btn+"');\" >剪 切</li> <li onMouseOver=\"this.style.backgroundColor='#F5FBFF'\" onMouseOut=\"this.style.backgroundColor=''\">復 制</li><li onMouseOver=\"this.style.backgroundColor='#F5FBFF'\" onMouseOut=\"this.style.backgroundColor=''\" >粘 貼</li> <hr><li onMouseOver=\"this.style.backgroundColor='#F5FBFF'\" onMouseOut=\"this.style.backgroundColor=''\" onclick=\"del("+btn+");\">刪 除</li> <hr><li onMouseOver=\"this.style.backgroundColor='#F5FBFF'\" onMouseOut=\"this.style.backgroundColor=''\" onclick=\"alert('你單擊文件名就可重命名!');\" >重命名</li><br/>";
ShowMenu(obj,0,0);
return false;
}
document.onmousemove=hiddenSubMenu;
attachEvent('onload', loadsubMenu);// JavaScript Document//等一下只要這樣調用就行了.
上一篇