<script>
function CoolMenuControl(){
//常规变量
thislastScrollX=;
thislastScrollY=;
thislastScrollW=;
thislastScrollH=;
thistd_X=;
thistd_Y=;
thistd_W=;
thistd_H=;
thistd=;
thismouseon=;
thiscurrent=null
thishk_name;
thishktable_name;
thismenudiv_name;
thismenutable_name;
thisml=;
thismenuarray=new Array();
thisspeed;
thishref="";
//菜单项目
function menuitem(typevalueurltarget){
thistype=type
thisvalue=value
thisurl=url
thistarget=target
}
//插入菜单
thisinsertmenu=function(typevalueurltarget){
thismenuarray[thismenuarraylength]=new menuitem(typevalueurltarget)
}
//程序初试化
thisinit=function(namebdcbgcspeedAlpha){
var inhtml=""
var cellcount=
var lastcellcount=
thishk_name=name+"hk"
thishktable_name=name+"hktable"
thismenudiv_name=name+"menudiv"
thismenutable_name=name+"menutable"
thisspeed=speed
for (i=;i<thismenuarraylength;i++)
{
if (thismenuarray[i]type=="") cellcount=cellcount+
if (thismenuarray[i]type=="" || thismenuarray[i]type=="") {cellcount=}
if (lastcellcount<cellcount) {lastcellcount++}
}
//alert(cellcount)
stylecode="cursor:hand;filter:Alpha(style=opacity="+Alpha+");backgroundcolor:"+bgc
suspendcode="<DIV id="+thishk_name+" style=POSITION:absolute; onclick="+name+"doClick()>"
+"<table id="+thishktable_name+" border= width= cellspacing= style=bordercollapse: collapse bordercolor="+bdc+">"
+"<tr><td height= style="+stylecode+"></td></tr></table></div>";
documentwrite(suspendcode);
var fcell=true
for (i=;i<thismenuarraylength;i++)
{
switch(thismenuarray[i]type)
{
case "":
t=cellcount*
if (t<=)
{
inhtml+=<tr><td colspan= class=ht onmouseover=+name+href="+thismenuarray[i]url++thismenuarray[i]target+">+thismenuarray[i]value
}
else
{
inhtml+=<tr><td colspan=+t+ class=ht onmouseover=+name+href="+thismenuarray[i]url++thismenuarray[i]target+">+thismenuarray[i]value
}
fcell=true
break;
case "":
t=(cellcount)*
if (t<=)
{
inhtml+=<tr><td width=><td onmouseover=+name+href="+thismenuarray[i]url++thismenuarray[i]target+">+thismenuarray[i]value
}
else
{
inhtml+=<tr><td width=><td colspan=+t+ onmouseover=+name+href="+thismenuarray[i]url++thismenuarray[i]target+">+thismenuarray[i]value
}
fcell=true
break;
case "":
if (fcell)
{
inhtml+=<tr><td width=><td onmouseover=+name+href="+thismenuarray[i]url++thismenuarray[i]target+">+thismenuarray[i]value;
fcell=false
}
else
{
inhtml+=<td width=><td onmouseover=+name+href="+thismenuarray[i]url++thismenuarray[i]target+">+thismenuarray[i]value;
}
break;
}
}
inhtml=<div id=+thismenudiv_name+ onmousemove="+name+doOver()">
+<table id=+thismenutable_name+ border="" cellpadding="" class="menu" cellspacing="">
+inhtml
+</table></div>;
//alert(inhtml)
documentwrite(inhtml);
thislastScrollX=;
thislastScrollY=;
thisposXY(eval(thismenutable_name)cells[])
thistd_W=eval(thismenutable_name)cells[]scrollWidth+
thistd_H=eval(thismenutable_name)cells[]scrollHeight
setInterval(name+"scrollback()")
}
//单击超连接
thisdoClick=function(){
//alert(thisurl)
var url=thishrefsplit("")
//alert(url[])
//alert(url[])
if (url[]=="") return
if (url[]=="_blank")
{windowopen(url[])}
else
{locationhref=url[]}
}
//滑动处理
thisscrollback=function(){
diffX=thistd_X
diffY=thistd_Y
diffW=thistd_W
diffH=thistd_H
percentX=thisspeed*(diffXthislastScrollX);
percentY=thisspeed*(diffYthislastScrollY);
percentW=thisspeed*(diffWthislastScrollW);
percentH=thisspeed*(diffHthislastScrollH);
if(percentX>)percentX=Mathceil(percentX);
else percentX=Mathfloor(percentX);
if(percentY>)percentY=Mathceil(percentY);
else percentY=Mathfloor(percentY);
if(percentW>)percentW=Mathceil(percentW);
else percentW=Mathfloor(percentW);
if(percentH>)percentH=Mathceil(percentH);
else percentH=Mathfloor(percentH);
eval(thishk_name)stylepixelTop+=percentY;
eval(thishk_name)stylepixelLeft+=percentX;
eval(thishktable_name)stylepixelWidth+=percentW;
eval(thishktable_name)stylepixelHeight+=percentH;
thislastScrollX=thislastScrollX+percentX;
thislastScrollY=thislastScrollY+percentY;
thislastScrollW=thislastScrollW+percentW;
thislastScrollH=thislastScrollH+percentH;
}
//滑出
thisdoOver=function() {
if (eventsrcElementtagName=="TD") {
if (eventsrcElementinnerTextlength== || eventsrcElementinnerText=="|") return
thisposXY(eventsrcElement)
thistd_W=eventsrcElementscrollWidth+
thistd_H=eventsrcElementscrollHeight
}
}
//绝对定位
thisposXY=function(obj){
hk_left=objoffsetLeft
hk_top=objoffsetTop
vParent = objoffsetParent;
while (vParenttagNametoUpperCase() != "BODY")
{
hk_left += vParentoffsetLeft;
hk_top += vParentoffsetTop;
vParent = vParentoffsetParent;
}
thistd_X=hk_left
thistd_Y=hk_top
}
//关于
thisabout=function(){
alert("OK")
}
}
</script>
<head>
<meta httpequiv="ContentLanguage" content="zhcn">
<style>
b{color=#;cursor:hand}
menu {
fontfamily:Arial;
cursor:Default;
fontsize:px;
border:px # solid;
bordercollapse: collapse;
filter:progid:DXImageTransformMicrosoftGradient(gradienttype= startcolorstr=#ffffff endcolorstr=#dddddd)
progid:DXImageTransformMicrosoftShadow(direction=color=#ccccccstrength=);
}
ht{
fontweight:bold
}
</style>
<!
第一步实体化XMenu类
用法:
var <实体变量>new CoolMenuControl()
>
<script language="javascript">
var CoolMenu=new CoolMenuControl()
var about=new Array()
about[]="关于XMenu菜单nnAuthor:PuterJamnCopyright n转载请通知本人"
about[]="关于作者nn"这家伙很懒什么也没留下!!"
</script>
</head>
<body>
<!
第二步建立菜单项目
用法:
<实体变量>insertmenu(类型Html代码链接网址目标)
类型0代表菜单标题1代表树型菜单子项目2代表横向菜单子项目
Html代码显示在菜单上的Html代码
链接网址不用多说了网址或Javascript脚本
目标默认为空既不在本页打开"_blank"代表在新的页面打开
例如:
CoolMenuinsertmenu("""<img src=http://wwwblueideacom/img/icon/arrowgif> 新浪网"""_blank")
>
<script>
CoolMenuinsertmenu("""本站首页""""")
CoolMenuinsertmenu("""新闻中心"""_blank")
CoolMenuinsertmenu("""文章中心"""_blank")
CoolMenuinsertmenu("""图片欣赏"""_blank")
CoolMenuinsertmenu("""软件下载"""_blank")
CoolMenuinsertmenu("""娱乐欣赏"""_blank")
</script>
<!
第三步建立菜单
用法:
<实体变量>init(实体变量名边框颜色背景颜色滑动速度背景半透明度)
实体变量名必须与<实体变量>相同
如果背景颜色="transparent"既为完全透明
例如:
CoolMenuinit("CoolMenu""#""#FFff")
>
<script>CoolMenuinit("CoolMenu""#""#FFff")</script>
</body>