主题:  如何将这个右键菜单合成一个JS文件?

kkfgef

职务:普通成员
等级:1
金币:0.0
发贴:1
#12004/7/31 23:01:28
<body oncontextmenu="return false"><style>
body,td,a {font-size:9pt;color:black}
.none{border:black 1px solid;background9D9D9;padding-top:2}
.over {border:black 1px solid;background:707888;color:white;padding-top:2}
</style>

<div style="position:absolute; left: 100; top: 100;cursor: hand;display='none';" ID=plane onmousedown="down=true;divleft=event.clientX-parseInt(plane.style.left);divtop=event.clientY-parseInt(plane.style.top)" onmouseup="down=false">
<div align=center style="position:absolute; left:150px; top:33px; width:100px; height:19px; z-index:1;color:white;background:707888;cursorefault;" class="none" onmouseover="menuin();init()">右键菜单</div>
<div align=center id="item1" style="position:absolute; left:50px; top:55px; width:99px; height:19px; z-index:2; filter:alpha(opacity=0)" onmouseover="this.className='over';menuin()"
onmouseout="this.className='none';" class="none"
>菜单项一</div>
<div align=center id="item2" style="position:absolute; left:250px; top:77px; width:99px; height:19px; z-index:3;filter:alpha(opacity=0)"
class=none onmouseover="this.className='over';menuin()"
onmouseout="this.className='none';">菜单项二</div>
<div align=center id="item3" style="position:absolute; left:50px; top:99px; width:99px; height:19px; z-index:4; filter:alpha(opacity=0)"
class=none onmouseover="this.className='over';menuin()"
onmouseout="this.className='none';">菜单项三</div>
<div align=center id="item4" style="position:absolute; left:250px; top:121px; width:99px; height:19px; z-index:5;filter:alpha(opacity=0)"
class=none onmouseover="this.className='over';menuin()"
onmouseout="this.className='none';">菜单项四</div> <div align=center id="item5" style="position:absolute; left:50px; top:143px; width:99px; height:19px; z-index:6; filter:alpha(opacity=0)"
class=none onmouseover="this.className='over';menuin()"
onmouseout="this.className='none';">菜单项五</div>

</div>
<script language="vbs">
dim down,divleft,divtop,timelinestart,timelinestop,tidone,tidtwo,tidtree
down=false
timelinestart=0
timelinestop=0
sub document_onmousedown
if window.event.button=2 then
plane.style.display=""
plane.style.left=window.event.clientx-153
plane.style.top=window.event.clienty-35
end if
end sub
sub document_onmousemove
if down then
plane.style.left=window.event.clientx-divleft
plane.style.top=window.event.clienty-divtop
end if

end sub
sub document_ondargstart
window.event.returnvalue=false
end sub
function menuin()
cleartimeout(tidtree)
end function
sub document_onclick
tidtree=settimeout("outit()",200)
end sub
function init()
if timelinestart<>5 then
cleartimeout(tidtwo)
item1.style.pixelLeft=item1.style.pixelLeft+20
item1.filters.alpha.opacity=item1.filters.alpha.opacity+20
item2.style.pixelLeft=item2.style.pixelLeft-20
item2.filters.alpha.opacity=item2.filters.alpha.opacity+20
item3.style.pixelLeft=item3.style.pixelLeft+20
item3.filters.alpha.opacity=item3.filters.alpha.opacity+20
item4.style.pixelLeft=item4.style.pixelLeft-20
item4.filters.alpha.opacity=item4.filters.alpha.opacity+20
item5.style.pixelLeft=item5.style.pixelLeft+20
item5.filters.alpha.opacity=item5.filters.alpha.opacity+20
timelinestart=timelinestart+1
else
cleartimeout(tidone)
end if
tidone=settimeout("init()",1)
end function
function outit()
if timelinestart<>0 then
cleartimeout(tidone)
item1.style.pixelLeft=item1.style.pixelLeft-20
item1.filters.alpha.opacity=item1.filters.alpha.opacity-20
item2.style.pixelLeft=item2.style.pixelLeft+20
item2.filters.alpha.opacity=item2.filters.alpha.opacity-20
item3.style.pixelLeft=item3.style.pixelLeft-20
item3.filters.alpha.opacity=item3.filters.alpha.opacity-20
item4.style.pixelLeft=item4.style.pixelLeft+20
item4.filters.alpha.opacity=item4.filters.alpha.opacity-20
item5.style.pixelLeft=item5.style.pixelLeft-20
item5.filters.alpha.opacity=item5.filters.alpha.opacity-20
timelinestart=timelinestart-1
else
cleartimeout(tidtwo)
plane.style.display="none"
exit function
end if
tidtwo=settimeout("outit()",1)
end function
</script><script>
<!--
if (!navigator.javaEnabled()) {
document.write("Warning:<br>Your Browser do not support java or java not be enabled.<br>Check newer version or enable java function";
}
var PopMenuWidth=200;
var TempOBJ;
var g_intX,g_intY; //localtion of mouse point in golbal var
var objLighting,objCurObj; //这两个全局变量前者用于定时器对象,后者用于递归所需传递的参数对象。
function inchmeal(objSrc){ //“淡入淡出”函数
var intTmp=(inchmeal.arguments.length>1)?inchmeal.arguments[1]:1; //intTmp的默认值为“1”,这个参数为此值时应用“淡出”效果;如果这个参数的值为零,那么将应用“淡入”效果。
if(intTmp){ //“淡出”
if(objSrc.filters.alpha.opacity<=80) objSrc.filters.alpha.opacity+=20; /*逐渐增大当前对象的滤镜的“透明度”属性的值,以达到当前对象逐渐明朗的“淡出”效果。*/
else if(window.objLighting) clearInterval(objLighting); //透明度已经达到最高值将结束“淡出”过程。
}
else{ //“淡入”
if(objSrc.filters.alpha.opacity>=20) objSrc.filters.alpha.opacity-=20; /*和上面相反,逐渐减小“透明度”,以达到“淡入”的效果。*/
else if(window.objLighting){
clearInterval(objLighting); //透明度达到最小值将结束“淡入”过程。
if(objSrc.tagName=='DIV') objCurObj.style.visibility="hidden"; //隐藏菜单所在的层
}
}
}
function showMenu(objSrc){ //定位并调用“淡入淡出”函数显示菜单
var intX,intY;
objCurObj=objSrc;
intX=(eval(event.clientX)<636)?eval(event.clientX):736;
intY=(eval(event.clientY)<320)?eval(event.clientY):420; //防止菜单“跑”到页面之外
objCurObj.style.pixelLeft=intX+document.body.scrollLeft;
objCurObj.style.pixelTop=intY+document.body.scrollTop; //将右键菜单移动到鼠标右下角
if(window.objLighting) clearInterval(objLighting); //如果有正在进行的“淡入淡出”过程先清除之
if(objCurObj.style.visibility=="visible" objCurObj.filters.alpha.opacity=0; //如果菜单已经显示先将此菜单设置为透明
objCurObj.style.visibility="visible"; //显示右键菜单
objLighting=setInterval('inchmeal(objCurObj)',45); //开始“淡出”
g_intX=intX;
g_intY=intY;
// clickMenu(MainMenuSel);
}

function showMenuSub(thisobject,objSrc){ //定位并调用“淡入淡出”函数显示菜单
var intX,intY;
objCurObj=objSrc;
// if ( TempOBJ != thisobject ) clickMenu(TempOBJ);
intX=(eval(event.clientX)<636)?eval(event.clientX):736;
intY=(eval(event.clientY)<320)?eval(event.clientY):420; //防止菜单“跑”到页面之外
objCurObj.style.pixelLeft=g_intX+202;
objCurObj.style.pixelTop=intY-20; //将右键菜单移动到鼠标右下角
if(window.objLighting) clearInterval(objLighting); //如果有正在进行的“淡入淡出”过程先清除之
if(objCurObj.style.visibility=="visible" objCurObj.filters.alpha.opacity=0; //如果菜单已经显示先将此菜单设置为透明
objCurObj.style.visibility="visible"; //显示右键菜单
objLighting=setInterval('inchmeal(objCurObj)',80); //开始“淡出”
TempOBJ=thisobject;
}


function clickMenu(objSrc){ // fade in
objCurObj=objSrc;
if(objCurObj.style.visibility=="visible"{ //already pop up.
if(window.objLighting) clearInterval(objLighting); //clear the fading process
objLighting=setInterval('inchmeal(objCurObj,0)',55); //begin fade in
}
}

</SCRIPT>


_____那两个js一个是vbscript写的,一个是javascript写的,所以不能直接合并,最多只能分别合一下
_____________那能不能将那个文件合成一个JS或是别的什么的呀!可以像那些CSS一样可以在别的网页中调用呀!
~~~~~~~~~~~~~~~~~~~
或是有什么方法让自制的右键可以像那些CSS一样可以在别的网页中调用呀!谢谢帮帮忙哦~~~~~
还有怎么样进行调用后面的html呢?谢谢哦!!!!!!!!!!